window.open()无法在ajax中工作

时间:2016-01-12 06:40:32

标签: javascript jquery ajax jquery-ajaxq

我想在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.");    

            }
    }); 

1 个答案:

答案 0 :(得分:1)

请使用

async:false

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

相关问题