0
我需要通过一个链接作为URL参数:-e的jQuery如何帕西一个复杂的URL作为参数
mywebsite.com?urlparam=anotherhost.com?somevar=var & anothervar = VAR2
我怎么会去jQuery中创建这种
我需要通过一个链接作为URL参数:-e的jQuery如何帕西一个复杂的URL作为参数
mywebsite.com?urlparam=anotherhost.com?somevar=var & anothervar = VAR2
我怎么会去jQuery中创建这种
使用:
var _URL = encodeURIComponent("anotherhost.com?somevar=var&anothervar=var2");
//result: anotherhost.com%3Fsomevar%3Dvar%26anothervar%3Dvar2
编码的URL,使用它作为一个url PARAM。
不是打电话与新网址:
location.href = "mywebsite.com?urlparam="+ _URL;
//result:"mywebsite.com?urlparam=anotherhost.com%3Fsomevar%3Dvar%26anothervar%3Dvar2"
这个重新装入新的URL页面。
享受。