raja
raja

Reputation: 39

Is it possible to send special character in parameter values in url path?

I have an url link "Change", a pop up window will get open when the user clicks the link. During that time, some parameters with values also sending in the url. Some parameter values contains special characters (' eg: &name=D'LOREY&lname=VALENTINE). If the value is full of alphabets it is working fine but throwing javascript error when the value contains special character. Please help to resolve this issue. Thanks in advance.

Upvotes: 1

Views: 874

Answers (2)

Tim Down
Tim Down

Reputation: 324497

Use encodeURIComponent on both the name and the value for your parameter. It's supported in all the mainstream desktop browsers going back to IE 5.5. If you need to support IE 5, you'll have to make do with escape, which as noted elsewhere is not perfect.

Upvotes: 6

Pointy
Pointy

Reputation: 413682

Look up the Javascript built-in escape function.

Upvotes: 0

Related Questions