好吧,我有这段代码从我从W3schools: -如何使用xmlhttp.open发送多个变量?
<html>
<head>
<script type="text/javascript">
function showCustomer(str)
{
var xmlhttp;
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getcustomer.asp?q="+str,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form action="">
<select name="customers" onchange="showCustomer(this.value)">
<option value="">Select a customer:</option>
<option value="ALFKI">Alfreds Futterkiste</option>
<option value="NORTS ">North/South</option>
<option value="WOLZA">Wolski Zajazd</option>
</select>
</form>
<br />
<div id="txtHint">Customer info will be listed here...</div>
</body>
</html>
现在我做了一个表格,我通过两个变量,所以我怎么会通过这个xmlhttp.open("GET","getcustomer.asp?q="+str,true);
两个变量的值。因为这件事没有被包括在内。
你为什么不从事JQuery的,它简单,因为它可以... – rkosegi 2012-03-31 14:47:39
jQuery也可以做到这一点?你有任何我可以参考的源链接,并可以开始学习。 – 2012-03-31 14:49:36
这是怎么回事:http://stackoverflow.com/questions/886878/can-i-get-more-variables-instead-of-string-in-jquery-ajax – rkosegi 2012-03-31 14:54:09