Smu*_*ger 0 javascript php xml get
我有一个脚本调用另一个PHP页面并使用PHP get传递值.
一个变量q与URL一起发送,其中str是一个变量.
xmlhttp.open("GET","getdata.php?q="+str,true);
Run Code Online (Sandbox Code Playgroud)
我想在URL字符串中发送一些多变量.
如何发送多个变量.
沿着:
xmlhttp.open("GET","getdata.php?q="+str+"y="+str2+"z="+str3,true);
Run Code Online (Sandbox Code Playgroud)
那里的URL就像那样
page.php?q=Peter&y=John&z=Smith
Run Code Online (Sandbox Code Playgroud)
你需要用&符号分隔它们,也可能对它们进行URL编码:
xmlhttp.open("GET","getdata.php?"
+ "q=" + encodeURIComponent(str)
+ "&y=" + encodeURIComponent(str2)
+ "&z=" + encodeURIComponent(str3), true);
Run Code Online (Sandbox Code Playgroud)
还没问题;)
| 归档时间: |
|
| 查看次数: |
1935 次 |
| 最近记录: |