This is my ajax funcion
var XMLHttpRequestObject = false;
if(window.XMLHttpRequest){
XMLHttpRequestObject= new XMLHttpRequest();
}
else if (window.ActiveXObject){
XMLHttpRequestObject= new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID)
{
document.getElementById(divID).innerHTML = "Loading...";
if(XMLHttpRequestObject)
{
var obj=document.getElementById(divID);
//alert(dataSource);
var dataSource = dataSource+'&done=ok';
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange =function ()
{
if(XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200){
obj.innerHTML = XMLHttpRequestObject.responseText;
document.getElementById(divID).innerHTML=XMLHttpRequestObject.responseText;
} //else {alert ('error'+dataSource)}
}
XMLHttpRequestObject.send(null);
}
}
and this is another function call above ajax function twice:
function getCityResult(value){
getData('aids/getRoutAjax.php?city='+value , 'rout');
getData('aids/getOriginDestAjax.php?city='+value , 'OriginDest');
}
and i have select menu as following:
<select name="city_id" id="city_id" class="" style="width:300px;" onchange="return getCityResult(this.value);">
<option value="">Select</option>
<option value="13">ABQ</option>
<option value="12">MUB</option>
<option value="14">UDH</option>
</select>
<div id="rout">
//Show some data
</div>
<div id="OriginDest">
// Show some data
</div>
my result is calling first one only to show data on div with id [rout] How can i call both on same time by this way??
Thanks