引发失败时代码:
$.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;
不要在success的回调函数中直接return,具体原因后面在考察!!
jQuery的ajax,当async为false时,同步操作失败。解决方案
原文:http://blog.csdn.net/sbt0198/article/details/39367837