Why can I not send more than one request?
Posted
by Doug
on Stack Overflow
See other posts from Stack Overflow
or by Doug
Published on 2010-05-17T07:43:35Z
Indexed on
2010/05/17
8:01 UTC
Read the original article
Hit count: 223
AJAX
function stateChanged(idname) {
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById(idname).value = xmlhttp.responseText;
}
}
}
function openSend(php,idname) {
stateChanged(idname);
xmlhttp.open("GET",php,true);
xmlhttp.send();
}
function showHint() {
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
openSend("time.php", "Time");
openSend("date1.php", "Date1");
openSend("date2.php", "Date2");
return;
}
These two say aborted (in Firebug) and doesn't return a value. Why is that? Is it because I can't send more than 1 request?
openSend("time.php", "Time");
openSend("date1.php", "Date1");
If I can't, how could I achieve 3 requests with only one invocation?
© Stack Overflow or respective owner