unix - Javascript refresh function problem -
i have problem following javascript code. want run background check (check.php) process on unix server. execution time of php , response takes 1.2-1.5 seconds (did test in mozilla) i've come script below refresh , check what's going on process , change background of div accordingly. right now, after few refreshes hangs, because think goes loop , doesn't wait first function finish , piles up. ideas doing wrong? more simpler way it? <script language="javascript" type="text/javascript"> function getval(param) { var strurl = param; var req = new xmlhttprequest(); req.open("get", strurl, false); //third parameter set false here req.send(null); return req.responsetext; } function changedivimage() { var pid = getval("check.php") var imgpath = new string(); imgpath = document.getelementbyid("status_body").style.backgroundimage; ...