当页面上充满了ajax请求,且都是同步时,可以通过设置全局变量来统一维护设定:
$.ajaxSetup({ async : false }); 如果有比较特殊的情况,则需要分别设定,这个时候需要使用最原来的ajax方法:
$.ajax({ type : "post", url : "register/user", data : "test=" + test, async : false, //同步 success : function(data){ data = eval("(" + data + ")"); } });