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? ?
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.I didn’t enter the if, so it didn’t pop up. Try to output data