How to open new window in Ajax jquery

To open a new window in Ajax jQuery, you can use the `window.open()` method in the `success` callback function of the Ajax request.

Here's an example code snippet:

$.ajax({
    url: 'your-url',
    success: function(data) {
        // use the data from the response to open a new window
        var newWindow = window.open('your-new-window-url', '_blank');
        newWindow.document.write(data);
    }

});

In the `success` function, you can use the `data` parameter to get the response data from the Ajax request. Then, you can use the `window.open()` method to open a new window with the specified URL. In this example, the new window will be opened in a new tab `(_blank)`.

After opening the new window, you can use the `document.write()` method to write the response data to the new window.

Note that some browsers may block the `window.open()` method, so you may need to handle this case appropriately.

Previous Post Next Post