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.
Here is my get_lat_lon:
function get_lat_lon(){
var mla = 0;
var mlo = 0;
var mz = 0;
var la = 0;
var lo = 0;
var na = 0;
mla = document.getElementById('mla').value;
mlo = document.getElementById('mlo').value;
mz = document.getElementById('mz').value;
la = document.getElementById('la').value;
lo = document.getElementById('lo').value;
na = document.getElementById('na').value;...
and this is my php output:
<input type="hidden" class="mla" id="mla" value="<?php echo $s1; ?>" />
<input type="text" class="mlo" id="mlo" value="<?php echo $s2; ?>" />
<input type="hidden" class="mz" id="mz" value="<?php echo $zoom; ?>" />
<input type="hidden" class="os" id="os" value="<?php echo $ostan; ?>" />
<input type="hidden" class="la" id="la" value="<?php echo $lat; ?>" />
<input type="hidden" class="lo" id="lo" value="<?php echo $lon; ?>" />
<input type="hidden" class="na" id="na" value="<?php echo $name; ?>" />