Shenglian / -WORK_TIP

工作上小技巧
4 stars 1 forks source link

[js] window.open #155

Open Shenglian opened 5 years ago

Shenglian commented 5 years ago

在回調代碼之前打開一個空窗口,例如var w=window.open(xxx); 然後在回調函數中設置它的location

var openWin = function(){
    var winRef = window.open("url","_blank");
    $.ajax({
        type: '',
        url: '',
        data: '',
        ......
        success:function(json){
            winRef.location = "新的url";
        }
    });
};