I'm using this function in onclick:
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
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 (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","reseller.php?ostan="+str,true);
xmlhttp.send();
get_lat_lon()
}
}
I need to call get_lat_lon() function right after previous works done, but get_lat_lon() starts it self before previous jobs complete.
I need to call get_lat_lon() without delay when I set 1s delay it works correctly.
UPDATE 1:
xmlhttp.open
and
xmlhttp.send
executed before my get_lat_lon() function,
question is how can I force my showUser()
function to execute get_lat_lon()
function after open
and send
finished?