On my site I have combobox in 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>
When user change item in combobox, method showUserVisits is called by ajax. And I must pass reservationObjectId to get_user.php site. How it is done GET method, by I want to pass this parameter by POST method because in GET method someone can change id. How can I do it ?
Thanks
Change this line:
To this:
See here for more info:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms757849(v=vs.85).aspx
Here are some examples:
http://www.openjs.com/articles/ajax_xmlhttp_using_post.php
One of the examples (from above link):