我得到以下代码传递值进行排序,它的工作正常。现在我想传递两个值而不是一个。 我努力但没有突破。请帮帮我
<script type="text/javascript">
function showUser(str)
{
if (str == "")
{
document.getElementById("txtHint").innerHTML = "";
return;
}
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "productlistajax.php?q=" + str, true);
xmlhttp.send();
}
</script>
正如您所看到的,我将“q”值传递给Ajax页面。
最好的问候
答案 0 :(得分:0)
通过GET请求传递多个参数是通过添加&amp;接着是下一个领域。
xmlhttp.open("GET", "productlistajax.php?q=" + str + "&version=250f3", true);
xmlhttp.send();
请注意上面代码中的&version=250f3
。