开发者

Using xmlhttp.open() how do I add more than one parameter to url?

开发者 https://www.devze.com 2023-01-03 17:17 出处:网络
I have this code. xml开发者_开发技巧http.open(\"GET\",\"getuser.php?q=\"+str,true); where q=\"+str

I have this code.

xml开发者_开发技巧http.open("GET","getuser.php?q="+str,true);

where q="+str

I want to pass a second var how do I do this?


xmlhttp.open("GET","getuser.php?q=" + q + "&r=" + r, true);

Note that this will not properly escape your parameters if they contains special characters. You might want to use something like encodeURIComponent(q) instead.


Append + "&anotherVar=" + anotherString.

0

精彩评论

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