使用xmlhttp.open()我怎么添加多个参数,网址是什么? [英] Using xmlhttp.open() how do I add more than one parameter to url?

查看:800
本文介绍了使用xmlhttp.open()我怎么添加多个参数,网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个code。

  xmlhttp.open(GET,getuser.php Q =?+ STR,真正的);

其中q =+海峡
 

我想通过第二个变种我该怎么办呢?

解决方案

  xmlhttp.open(GET,?getuser.php Q =+ Q +&放大器; R = + R,真正的);
 

请注意,这将无法正常逃不出你的参数,如果它们包含特殊字符。你可能想使用类似连接codeURIComponent(Q)代替。

I have this code.

xmlhttp.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.

这篇关于使用xmlhttp.open()我怎么添加多个参数,网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆