ajax回调中执行window.open被拦截的解决办法

时间:2023-12-21 08:29:14

From:https://blog.csdn.net/winy_lm/article/details/60959751

ajax async设为false即同步调用

//去支付
function gotoPay(param) {
$.ajax({
type: "post",
url: "/xxxx/xxxx",
async: false,// 只加了个同步
data: {"param": param},
error: function (data) {
showError(data);
},
success: function (data) {
  window.open("b.html");//

}
});
}

From:https://www.cnblogs.com/xuejianxiyang/p/9675178.html