Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querystring and & 1

Status
Not open for further replies.

seanybravo

IS-IT--Management
Sep 24, 2003
89
GB
I am trying to send some category information using a querystring unfortunateley some categories have a & in. I have managed to sort the spaces our but I am still having trouble with the andpersand.

Code:
	strSend.replace(/ /g, "+")
	strSend.replace(/&/gi, "%26")

Can anyone please explain why this is failing to work.

Thanks
 
try using a leading backslash. special characters need to be "escaped" in regular expressions. also, i believe you need to set a variable to hold the result of the call to replace...

Code:
[red]strSend = [/red]strSend.replace(/[red]\[/red]&/gi, "%26")



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top