Loading... 我们都知道$.post() 和 $.get()都是异步请求的方式,但有时候不得不用,但又要同步请求时,就用到了上面写的。 ```js //设置为同步 $.ajaxSettings.async = false; $.post("url", data, function(result) { // 请求处理 },"json"); //设置回异步 $.ajaxSettings.async = true; ``` ```js $.ajax({ type: "post", url: "url", data: {"reportId": rows[0].reportId}, async: false, success: function(result){ if (result.success){}else{} } }); ``` 最后修改:2021 年 12 月 24 日 © 允许规范转载 打赏 赞赏作者 微信 赞 0 如果觉得我的文章对你有用,请随意赞赏