Jquery.Validation IE和FF问题

时间:2013-09-07 10:07:43

标签: php jquery validation jqueryform

你好伙计们我​​遇到了jquery验证插件的问题。代码在chromeOpera中工作正常,而不在EI版本10.0.xx和FF版本23.xx中 每当我点击按钮提交表格时它就无法运作

     <script src="style/js/jquery.js"></script>
    <script src="style/js/jquery.validate.js"></script>
<script type="text/javascript" src="style/js/jquery.form.js"></script>
      <script type="text/javascript">
      $(document).ready(function(){
            var kosh = document.getElementById("username").value;
            $("#form").validate({
                rules:{
                    full_name:"required",
                    user_name:"required",
                    secret:"required",
                    user_email:{
                            required:true,
                            email: true
                        },
                    pwd:{
                        required:true,
                        minlength: 8
                    },
                    cpwd:{
                        required:true,
                        equalTo: "#pwd"
                    },
                    gender:"required",
                    privacy:"required"
                },
                messages:{
                    full_name:"Enter your first and last name",
                    user_name:"Please Chose a Username",
                    secret:"Your Secret Word Can't Be Empty",
                    user_email:{
                        required:"Enter your email address",
                        email:"Enter valid email address"
                    },
                    pwd:{
                        required:"Enter your password",
                        minlength:"Password must be minimum 8 characters"
                    },
                    cpwd:{
                        required:"Enter confirm password",
                        equalTo:"Password and Confirm Password must match"
                    },
                    gender:"Select Gender",
                    privacy:"Select How you like to share your photos with others"
                },
                errorClass: "help-inline",
                errorElement: "span",
                highlight:function(element, errorClass, validClass) {
                    $(element).parents('.control-group').addClass('error');
                },
                unhighlight: function(element, errorClass, validClass) {
                    $(element).parents('.control-group').removeClass('error');
                    $(element).parents('.control-group').addClass('success');
                }
            });         
$('document').ready(function()
{
$('#form').ajaxForm( {
target: '#preview', 
success: function() { 
$('#formbox').slideUp('fast'); 
} 
}); 
$('#loginForm').ajaxForm( {
target: '#preview', 
success: function() { 
$('#formbox').slideUp('fast'); 
} 
});
});

        });
      </script>

和我的表格如下

          <form action="func/login.php" id="loginForm" name="loginForm" method="post" class="navbar-form pull-right">

          <input required class="input-large" name="user" placeholder="Your Username..." type="text">
          <input  required type="password" name="pass"  placeholder="Your Password" class="input-large">
        <button class="btn btn-success">Login !</button>
        <a href="reset.php"><span style="color:#fff; position:relative; top:3px; align:center; font-family:verdana;padding:3px; font-size:10px">Forgot Password?</span></a>
      </form>

假设我输入了错误的用户名和密码,它实际上会返回结果但是每当用户名和密码都正确时,它就不会从php脚本中获得结果,如果用户名和密码正确,它会自动加载{{ 1}}但它不会加载它但我已登录,如果我输入index.php到网址栏

1 个答案:

答案 0 :(得分:0)

通过替换

来修复它
echo'<meta http-equiv="refresh" content="0;URL=index.php">';

echo'<script>document.location.href="index.php"</script>';

我不知道为什么FF和IE不接受元标记