souporpo...@gmail.com wrote:
Quote:
I am using ajax as follows:
>
var parameters = "groups=" + escape(myemail+...@gmail.com);
var url="/mydomain/ajaxCall";
>
* * * * if (req != null) {
>
* * * * * * * req.open("POST", url, true);
* * * * * * * req.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
* * * * * * * req.send(parameters);
* * * * * * * req.onreadystatechange=processResp2;
* * * * }
>
I noticed that inside the ajaxCall the plus (+) sign is replaced with
a space in the string escaped (myemail 1...@gmal.com)
>
Could someone tell me how to do this correctly?
'+' is a reserved character; it is one of the 2 possible ways to
percent-encode a space (the other one is '%20'). You should send '%2B'
if you want to send the plus-sign.
See section 2.2.in RFC 3986:
http://www.ietf.org/rfc/rfc3986.txt
In your code:
parameters = parameters.replace(/\+/g,'%2B');
More info:
http://en.wikipedia.org/wiki/Percent-encoding
Hope this helps,
--
Bart