jQuery’s ajax, when async is false, the synchronization operation fails. Solution, jQueryasync
recently encountered jquery's Ajax of Jquery. When Async is False, the problem of failed to operate synchronously, search online, and get the solution.
$.ajax({ url : 'your url', data:{name:value}, cache : false, async : true, type : "POST", dataType : 'json/xml/html', success : function (result){ return result; } });
var ret = null; $.ajax({ url : 'your url', data:{name:value}, cache : false, async : true, type : "POST", dataType : 'json/xml/html', success : function (result){ ret=result; } }); return ret;
Don’t return directly in the success callback function, the specific reasons will be investigated later! !
$ajax() is invalid for setting synchronous submission. The code is as follows. Async: "false" is set but it is still submitted asynchronously.
The original purpose of ajax is to perform asynchronous operations, and the latest jQuery version has even deprecated the async parameter. .
jquery $ajax function, async: "false", if it doesn't work, please help