我使用codeignitor。以下是我用於登錄表單驗證的jQuery代碼。表單提交後jquery重定向
$("#login_form").validate({
errorPlacement: function(error, element) { },// Disable error messages
debug:true,
rules: {
username:
{
required: true,
remote:
{
url: "http://localhost/my_site/index_page/validate_username_password",
type: "post",
data: {
password: function(){ return $("#password").val(); } //Password is sent alongside the username
}
}
},
password:{required:true}
},
highlight: function(username, errorClass)
{
$(username).fadeOut(function()
{
$(username).fadeIn();
});
},
submitHandler: function(form) // CALLED ON SUCCESSFUL VALIDATION
{
window.location.replace='http://localhost/my_site/index_page';
}
});
通過這個代碼,成功驗證後,我期待我的網頁重定向到
http://localhost/my_site/index_page
,但事實並非如此。
我使用codeignitor。
是submitHandler解僱?控制檯/網絡選項卡中的任何錯誤? –
發送處理程序。我用alert()來檢查它。在cosole/Network選項卡中沒有錯誤。 –
用什麼來代替:'window.location.replace('...');'?! –