我有這段代碼。使用xmlhttp.open()如何向url添加多個參數?
xmlhttp.open("GET","getuser.php?q="+str,true);
where q="+str
我想傳遞第二個var我該如何做?
我有這段代碼。使用xmlhttp.open()如何向url添加多個參數?
xmlhttp.open("GET","getuser.php?q="+str,true);
where q="+str
我想傳遞第二個var我該如何做?
xmlhttp.open("GET","getuser.php?q=" + q + "&r=" + r, true);
請注意,如果它們包含特殊字符,這將不會正確地轉義您的參數。您可能需要使用類似encodeURIComponent(q)
的內容。
謝謝,我會看看encodeURICompinent() – JamesTBennett 2010-06-17 23:31:14
哥們。這幫助我太多了。謝謝 – Mikey3Strings 2016-07-09 17:55:48
附加+ "&anotherVar=" + anotherString
。
我不知道這意味着什麼。 – JamesTBennett 2010-06-17 23:29:40