asynchronous - ajax synchronous call with timeout -
New to AJAX, so asking a very basic question.
- Is there no way to set up a synchronous Ajax call with time (async: false)?
Asynchronous works well with calls from time to time, though in my application, but for a special scenario, let me synchronously call (Javascript actually until this Waiting for the server should wait), and it works fine but I have to handle a scenario where it can take longer and can be called an AJAX timeout.
Can I refer to another piece of standard document for AJAX?
Thanks
Actually, during a synchronous Ajax request, the browser is blocked And no JavaScript can be executed because this browser is blocked, jQuery can not cancel the AJAX request after the timeout set because jQuery is javascript and the browser can not be executed while the browser is blocked. This is the primary drawback in Synchronous Ajax.
Any time you might want a synchronous request, you should use an asynchronous instead, after which the callback should be, as shown below;
$ AJAX ({url: 'webservices.php', timeout: 200, datatype: 'Jason', data: {'CMD': 'ping'}, success: function (data, textstats) {$ .ajax ({url: 'Webservices.php', async: incorrect, data type: 'jason', data: {'CMD': 'feedback', 'data': data, 'user information': window.dsuser}, success: function (data, TextStats) {// Success !, Status ("Thanks for Response," + window.dsuser.user + "!");}});}, Error: Function (jqhdr, textStatus, errorThrown) {status ("Your There was a problem sending the response Try Prahlad in ");}});
Comments
Post a Comment