window.open(url)未在同一选项卡中打开新网页

Nit*_*hat 1 html javascript jquery window

window.open("index.php");不会在同一选项卡中打开新页面,而是在选项卡中打开它.

我也试过window.open("index.php",'_self')了,根本没打开标签.

这是我的代码:

$.ajax({
    url: "login.php",
    type: 'POST',
    data : "username="+name+"&password="+pwd ,
    datatype :"text",
    async: false, 
    cache: true,
    timeout: 30000,
    error: function() {
        return true;
    },
    success: function(msg) {                        

       if(msg == "Validated")
        {
            alert(msg);
            window.open("index.php");
        }
        if(msg=="Incorrect password")
        {
            alert(msg);
            location.reload();                         
        }    
    }
});
Run Code Online (Sandbox Code Playgroud)

Ken*_*eth 5

而不是window.open你应该使用window.location = "http://...."