在我的网站上,我在 php 中有组合框:
<script type="text/javascript">
function showUserVisits(reservationObjectId)
{
//alert(reservationObjectId);
if (reservationObjectId == "")
{
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","get_user.php?q=" +reservationObjectId,true);
xmlhttp.send();
}
</script>
<form>
<select name="users" onchange="showUserVisits(this.value)">
<!-- <option value="">Select a person:</option> -->
<option value="1">aaa1</option>
<option value="2">aaa2</option>
<option value="3">aaa3</option>
<option value="4">aaa4</option>
</select>
</form>
当用户更改组合框中的项目时,ajax 会调用方法 showUserVisits。而且我必须将 reservationObjectId 传递给 get_user.php 站点。它是如何完成的 GET 方法,我想通过 POST 方法传递这个参数,因为在 GET 方法中有人可以更改 id。我该怎么做 ?
谢谢