开发者

escape & in url

开发者 https://www.devze.com 2023-01-04 01:24 出处:网络
How can I escape & (ampersand) in url with the correct replacement in the jQuery function. I have tried

How can I escape & (ampersand) in url with the correct replacement in the jQuery function. I have tried

.replace("/&/g", "&")  
.replace("/&/g", "%26") 
.replace("/&/g", "\&") 

But nothing is w开发者_Python百科orking.

If anyone has idea please share with me.

Thanks


If you need to just escape a URL, I recommend using a JavaScript function such as encodeURIComponent.


Try the URLEncode plugin: http://plugins.jquery.com/project/URLEncode

0

精彩评论

暂无评论...
验证码 换一张
取 消