Why can't I open a window after ajax returns?
Code:
$.ajax( {
url: '/fb/index.php',
data:{data: 1},
type:'post',
success:function(data) {
window.open("http://www.jb51.net");
},
error : function() {
console.log("error2");
}
});
Why is there no new window opened? Please give me some advice? ?
曾经蜡笔没有小新2017-05-19 10:31:47
I have encountered this pitfall before. 异步
的AJAX
回调中使用window.open
,会被浏览器拦截,把AJAX
It can be solved by changing it to synchronization. The questioner can give it a try.