473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Plus sign not shown

Hi All

I am using ajax as follows:

var parameters = "groups=" + escape(my*********@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 10*@gmal.com)

Could someone tell me how to do this correctly?

Thanks
Oct 16 '08 #1
5 9056
souporpo...@gmail.com wrote:
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
Oct 16 '08 #2
On Oct 16, 10:07*am, Bart Van der Donck <b...@nijlen.comwrote:
souporpo...@gmail.com wrote:
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
Thanks for the clarification. I tried replace as suggested above
and also encodeURI. The plus sign still gets dropped.

I don't know what else to try. Your kind help is appreciated.
Oct 16 '08 #3
so*********@gmail.com wrote:
Bart Van der Donck wrote:
>souporpo...@gmail.com wrote:
>>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; [...]
In your code:

parameters = parameters.replace(/\+/g,'%2B');
[...]

I tried replace as suggested above and also encodeURI. The plus sign
still gets dropped.

I don't know what else to try. Your kind help is appreciated.
You could post the code that you are using. The code that you have posted
so far does not run because it is syntactically invalid (you did not quote
the argument of escape); who knows what other typos/omissions are there.

Please trim your quotes to the relevant parts.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Oct 16 '08 #4
On Oct 17, 12:20*am, "souporpo...@gmail.com" <soup_or_po...@yahoo.com>
wrote:
Thanks for the clarification. I tried replace as suggested above
and also encodeURI. The plus sign still gets dropped.

I don't know what else to try. Your kind help is appreciated.
Use encodeURIComponent() instead of escape() for encoding your POST
data.

/sasuke
Oct 17 '08 #5
On Oct 16, 10:50*pm, sasuke <database...@gmail.comwrote:
On Oct 17, 12:20*am, "souporpo...@gmail.com" <soup_or_po...@yahoo.com>
wrote:
Thanks for the clarification. I tried replace as suggested above
and also encodeURI. The plus sign still gets dropped.
I don't know what else to try. Your kind help is appreciated.

Use encodeURIComponent() instead of escape() for encoding your POST
data.

/sasuke
thank you; the encodeURIComponent worked like a charm

regards
Oct 17 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: r0adh0g | last post by:
I am attempting to build a primitive search form on my site. It is searching an Access Database Table and comparing on field in the database to a field passed from the form. Works great if only...
1
by: lbbs | last post by:
Newbie, so please don't flame me. I am just starting to learn access. I seem a feature in access a while ago, but don't remember what it was called. I seen project lab example that had, a plus...
2
by: Tim Wallace | last post by:
Perhaps my original post wasn't clear enough, so I'll try to reword. I only want to retrieve a node at a time for my treeview control. As the user clickes the plus sign, I will populate child...
0
by: Emil Georgiev | last post by:
Hell I have a Web Custom Control project in ASP.NET. I'm using a subclassing technique to add functionality in HyperLink web server control. I want to create a property "BrowserWindow" of my...
2
by: B-Dog | last post by:
I was trying to use the treeview and was wondering if there was a way to make the treeview select the node when you click the plus sign next to it. The only way I've found to do it is to actually...
2
by: Dave Bazell | last post by:
I was using Math::BigInt and found that postive integers have a leading plus sign: +12345678900000 Is there a way to supress this? Thanks, Dave
2
by: Robert Bravery | last post by:
Hi all I have a dataset with three tables. On my form I have two grids. Both grids have the default plus sign on the side of the grid. I have set up my tables and columns collection the way I...
2
by: blue_nirvana | last post by:
Is there an event that fires when a user clicks the plus sign in a Master/Detail datagrid? It would be even better if I could catch when the user clicks the link to see the detail records. What...
1
by: =?Utf-8?B?Sm9zdWZm?= | last post by:
Hi: I've been using MSN Bill Pay for years to pay my bills. I recently decided to look into Microsoft Money as I wanted a desktop application to manage and pay my bills. I downloaded the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.