window.open()在ajax中不起作用

window.open() not working in ajax

本文关键字:ajax 不起作用 open window      更新时间:2023-09-26

我只想在ajax返回成功后打开一个窗口。但它不起作用。窗口未打开。以下是示例代码。

 $.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.");    
            }
    }); 

请使用

async:false

在ajax中,调用。这是因为浏览器限制了ajax调用中弹出窗口的打开。如果ajax调用是同步的,那么窗口将打开,不会出现任何问题。