JQuery ajax. If async is set to false, the synchronization operation fails. Solution: jqueryasync
Leading to failure:
$.ajax({ url : 'your url', data:{name:value}, cache : false, async : true, type : "POST", dataType : 'json/xml/html', success : function (result){ return result; } });
Solution:
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;
Note:
Do not return directly in the callback function of success. The specific cause will be investigated later !!
$ Ajax () Setting synchronous submission is invalid. The Code is as follows: async is set to "false", but it is still asynchronously submitted.
Ajax originally intended to perform asynchronous operations, and the latest jquery version even has discarded the async parameter.
If you only want to use ajax for server interaction and do not need to asynchronously refresh the effect, you can use a callback function.
The async: "false" in the jquery $ ajax function does not work.
"False" is a string when double quotation marks are added. A non-empty string is true.
Remove double quotation marks.