W3C home > Mailing lists > Public > public-webapi@w3.org > March 2007

Re: [XHR] Unespected case

From: denis sureau <scriptet@gmail.com>
Date: Mon, 5 Mar 2007 15:08:48 +0100
Message-ID: <eb81e42b0703050608s684093d7l57d4ad2b264ddfe9@mail.gmail.com>
To: public-webapi@w3.org
> client.open("POST", "/ping");

> I suppose that this call cannot works fine. Maybe that on the web server
> root there is a page named simplly "ping", actually if you made the above
> call the response is processed correctly [2] .
> I think that, for a back-compatiblity, you need to provide a different mode
> to make a ping call on the server.
> Or I misunderstand the meaning of the example?

The ping example seems not the best example of what a POST request usually is.
I suggest a more useful request as following, instead:

var xhr = new XMLHttpRequest();
if(xhr.readyState == 4)
alert("sent " + data);

xhr.open("POST", "test.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("data=" + data);

Denis Sureau - webmaster@xul.fr
Received on Tuesday, 6 March 2007 20:38:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:57 GMT