Parag
Parag

Reputation: 379

window.open() not working in ajax

I want to open a window only after ajax returns success. But it does not work. Window does not open. Following is the sample code.

 $.ajax({
           type: "POST",
            url : 'checkIfMemberIsAPaidMember.php',  
            dataType : "html",
            success: function(data)
            {  
                var w = window.open('expressInterestPopUp.php','_blank','resizable = no, toolbar = 0,location = no, menubar = 0, height = 400, width = 600, left = 400,top = 300');

                },
            error : function()
            {       
                    alert("Sorry, The requested property could not be  found.");    

            }
    }); 

Upvotes: 0

Views: 1601

Answers (1)

dpmohali
dpmohali

Reputation: 56

Please use

async:false

in the ajax, call. This is because the browsers restrict opening of pop-ups in ajax calls. If the ajax call is synchronous, then the window will open, without any issues.

Upvotes: 1

Related Questions