This does not affect your script.
This means that when executing synchronous AJAX requests, you cannot use the deferred API displayed by the object returned by $.ajax() (for example, done () or fail () , for example), but use the complete and error handlers instead.
In other words, your code already uses the correct template. You will have to change it if it used pending operations, for example:
// Do not write this code. $.ajax({ type: 'POST', url: REQUEST_URL, async: false, // <-- Synchronous request. data: { 'id': id }, dataType: 'json' }).done(function(output) { // <-- Use of deferred method. // success }).fail(function() { // <-- There also. alert('Error, please refresh the page'); });
source share