简体   繁体   English

jQuery.Validation IE和FF问题

[英]Jquery.Validation IE and FF issue

hello guys i'm having an issue with the jquery validation plugin. 大家好,我在jquery验证插件上遇到了问题。 the code works fine in chrome and Opera while not in EI version 10.0.xx and FF version 23.xx whenever i click the button to submit the form it wont work 每当我单击按钮提交表单时,代码在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>

and my form as follow 和我的形式如下

          <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>

lets say if i typed the wrong username and password it actually returns the result but whenever the username and password are correct it doesn't get the result from the php script which if username and password are correct it automatically load the index.php but it wont load it but i already signed in, if i typed the index.php to the url bar 可以说如果我输入了错误的用户名和密码,它实际上会返回结果,但是只要用户名和密码正确,它都不会从php脚本中得到结果,如果用户名和密码正确,它将自动加载index.php但是如果我在网址列输入index.php ,将无法载入,但我已经登入

fix it by replacing 通过更换来修复

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

to

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

which i don't know why FF and IE wont accept the meta tag 我不知道为什么FF和IE不会接受meta标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM