PHP中的标题重定向不起作用也不是元刷新

时间:2015-07-04 20:00:29

标签: javascript php jquery ajax redirect

我正在编写一个基本的注册系统(对于我的PHP,JavaScript实践),我面临一个恼人的错误。我通过jquery / ajax提交登录表单,将表单数据发送到process.php文件,并从process.php文件中获取html响应,以在登录页面上显示错误/成功消息。

成功验证后,我想将用户重定向到index.php但在我的情况下,标题("位置:index.php");没有重定向用户,而是在login.php上获取并显示index.php页面,并带有已重复的导航和标题。

我已尝试过数据-ajax =" false"形式但没有运气。元刷新可以帮助Chrome,但在Firefox中它并不起作用。有解决方案吗?我的JS文件包含以下代码:

$(document).ready(function() {
$("#regmein").submit(function() {       
    $.ajax({
        type: "POST",
        url: 'inc/process.php',
        data:$("#regmein").serialize(),
        success: function (data) {  
            // Inserting html into the result div on success
            $('#form-result').html(data);
        },
        error: function(jqXHR, text, error){
        // Displaying if there are any errors
            $('#form-result').html(error);           
    }
});
    return false;
});
});

0 个答案:

没有答案