Rob suggested: > Alternatively you could use a globally accessibly variable which states > whether there is a pending request or not. > When a request is sent, set it true, when the response is received set > it false.
Something like this? var pending = false; function send_message(msg) { pending = true; var params = {}; params['plugger_debug_message'] = msg; $.post("/myhandler.php", params, function() { pending = false;}); while (pending); } I had also tried that, but I get a browser timeout after 30 seconds. Any more thoughts? thanks