i need to get 4 request from the server, i have stored all this 4 urls in this way. for information this is raw url (http://www.earthtools.org/timezone/40.714352/-74.0059731);
var nationZone = {
getNewYorkLocalTime : 'getTime.php?lat=40.7143528&lan=-74.0059731',
getLondonLocalTime : 'getTime.php?lat=51.5001524&lan=-0.1262362',
getChennaiLocalTime : 'getTime.php?lat=13.060422&lan=80.249583',
getBangaloreLocalTime:'getTime.php?lat=12.9715987&lan=77.5945627'
}
this is calling my getTime.php and retrieving the result.
for that, i created this for in loop, but this prints only one time intead of 4 times? how can i make this to call 4 request ?
for(zone in nationZone ){
if (window.XMLHttpRequest){
zone=new XMLHttpRequest();
}else{
zone=new ActiveXObject("Microsoft.XMLHTTP");
}
zone.onreadystatechange=function() {
if(zone.readyState==4 && zone.status==200){
alert(zone.responseText);
}
}
zone.open("GET",nationZone[zone],true);
zone.send();
}
I do not mind using a solution that involves an additional third party library