The question is, do you want to skip the Ajax call if the previous call is still busy or not? If you want to skip this solution, it is easy, and one of them is perfect for you. However, if you want to start making a call after completing the previous one, this is a completely different story. If necessary, I can provide you with a code.
Worked on the solution:
<script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script> <script language="javascript" type="text/javascript"> var requestInProcess = false; var timer = null; function requestSomeStuffA() { var responseHolder = $("responseHolder"); new Ajax.Request( "http://webservicelocation/", { method: 'GET', contentType: 'application/json; charset=utf-8', onCreate: function() { requestInProcess = true; }, onSuccess: function(transport) { </script>
When you call the first request of SomeStuffA and then requestSomeStuffB, requestSomeStuffB will wait for the completion of the requestSomeStuffA. Hope this is helpful for you.
source share