sending data with +sign in url


hello guys,

today , i got one problem

i had to send one variable through url to next page and i was fetching that variable using _GET[‘variablename’] but i couldn’t got proper value. because variable contains + sign say(b+).

code with problem

var url="searchCity.php?c="+bg;


if any variable contains + sing or other sign then use encodeURIComponent() function to encode url.

correct code

var url="searchbg.php?c="+ encodeURIComponent(bg);

Now you get full value of variable with +sign.!


2 thoughts on “sending data with +sign in url

  1. I don’t even understand how I ended up here, but I believed this publish was once good. I do not realize who you are but definitely you are going to a famous blogger when you aren’t already.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s