Open a new window after successful Ajax request () solution to interception



The previous development project encountered a problem, AJAX asynchronous request after the success of the need to open a new window to open the URL, using the () method, but unfortunately it was intercepted by the browser. How to solve this problem?

The reason why the browser intercepts a new window is that the operation is not triggered by the user, so it thinks it is unsafe and intercepts it (if it is)_ Even if the Ajax callback function simulates the click or submit user behavior (trigger (‘click ‘)), the browser will consider that it is not triggered by the user, so it cannot be executed safely, so it is intercepted.

1. Asynchronous to synchronous, that is: async:false

2. Point the new window to an object, and then modify the URL of the object

var w =;
type: 'POST',
url: '/surveyTask',
dataType: 'json',
error: function(){
success: function(res){
w.location = res.url;

Finally, it should be noted that the method of dynamically adding a new form window on the Internet is not suitable for Ajax requests. At least the blogger has been intercepted by the browser after testing.