Synchronous request with ajax in a loop
问题 I have a for loop which contains ajax request. The request is working aynchronously. So i can't reach the result of request in time. How can i solve this problem without using any library? Thanks. var availables = document.getElementsByClassName("available"); for(var i=0;i<availables.length;i++){ var element = availables[i]; var xmlhttp; if(window.XMLHttpRequest) xmlhttp = new XMLHttpRequest; else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("GET", "control.php?user=" +