[英]how to pass two value to PHP ajax page
我得到以下代码传递用于排序的值,它的工作正常。 现在我想传递两个值而不是一个。 我尽力但没有突破。 请帮我
<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页面。
最好的祝福
通过在GET请求中传递多个参数,方法是在&后面加上下一个字段。
xmlhttp.open("GET", "productlistajax.php?q=" + str + "&version=250f3", true);
xmlhttp.send();
注意上面的代码中的&version=250f3
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.