Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15540
| From | Christoph Becker <cmbecker69@gmx.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: XMLHttpRequest: POST with Data |
| Date | 2012-08-24 01:11 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <k16d9n$tqa$1@speranza.aioe.org> (permalink) |
| References | <429d38h112ptste9sp22ks8sqk9cgumo7r@4ax.com> |
Gene Wirchenko wrote:
> Dear JavaScripters:
>
> I am trying to pass data back and forth using XMLHttpRequest. I
> have run into a few issues. The first one is the most important.
>
> 1) I can not get POST to work according to various documentation I
> have found on the Web.
>
> Suppposedly, the .open() and .send() would be
> oRequest.open("POST",Url,true);
> oRequest.send(DataToSend);
> but with this, at the server end, the .QueryString value is ""
> regardless of what was supposedly sent.
If you send a POST request (without any additional query string), no
query string will be sent (so .QueryString, which is supposedly .NET,
will be empty). You have to look at some other
property/variable/function (in PHP it would be $_POST).
>
> I have found that using the GET style of
> oRequest.open("POST",Url+"?"+DataToSend,true);
> oRequest.send();
> does work. At least, it appears to.
>
> Am I doing something wrong, or is the documentation wrong?
>
> 2) What should I do for escaping of data? Going to the server, any
> line breaks get eaten somewhere so I use escape() at browser and
> unescape() at server. Going from server to browser, line break are
> not eaten. Does this mean that I do not have to escape()/unescape()
> on the trip back?
>
> Are escape() and unescape() the correct functions to use?
For POST requests escaping on the client side should not be necessary.
For GET requests encodeURI() resp. encodeURIComponent seem to be more
appropriate.
How to escape when sending data to the client depends.
>
> Sincerely,
>
> Gene Wirchenko
Hope that help a bit.
--
Christoph M. Becker
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 15:00 -0700
Re: XMLHttpRequest: POST with Data "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-23 22:48 +0000
Re: XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 16:40 -0700
Re: XMLHttpRequest: POST with Data "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-26 20:39 +0000
Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-24 01:11 +0200
Re: XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 16:42 -0700
Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-24 02:54 +0200
Re: XMLHttpRequest: POST with Data Gene Wirchenko <genew@ocis.net> - 2012-08-23 19:04 -0700
Re: XMLHttpRequest: POST with Data Tim Streater <timstreater@greenbee.net> - 2012-08-24 08:57 +0100
Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-25 12:02 +0200
Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-25 14:09 +0200
Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-25 15:20 +0200
Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-26 15:49 +0200
Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-26 19:15 +0200
Re: XMLHttpRequest: POST with Data Stefan Weiss <krewecherl@gmail.com> - 2012-08-26 19:54 +0200
Re: XMLHttpRequest: POST with Data Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-26 21:43 +0200
Re: XMLHttpRequest: POST with Data Christoph Becker <cmbecker69@gmx.de> - 2012-08-26 23:42 +0200
Re: XMLHttpRequest: POST with Data Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-24 02:55 +0000
Re: XMLHttpRequest: POST with Data "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-08-23 19:28 -0700
Re: XMLHttpRequest: POST with Data "Tom de Neef" <tdeneef@qolor.nl> - 2012-08-24 15:58 +0200
Re: XMLHttpRequest: POST with Data Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-08-26 08:38 +1000
Re: XMLHttpRequest: POST with Data Mike Winter <usenet@michael-winter.me.invalid> - 2012-08-26 14:59 +0100
csiph-web