php - 在 Internet Explorer 上使用 jquery 时出现问题

标签 php jquery ajax

Jquery 无法在 Internet Explorer 上运行。但是它可以在其他网络浏览器上运行。 我写的代码是

<html>
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
        $("#myform").validate({
            debug: false,
            rules: {
                name: "required",
                email: {
                    required: true,
                    email: true
                }
            },
            messages: {
                name: "Please let us know who you are.",
                email: "A valid email will help us get in touch with you.",
            },
            submitHandler: function(form)
            {
                $.post('process.php', $("#myform").serialize(), function(data)
                {
                    $('#results').html(data);
                });
            }
        });
    });
    </script>

</head>
<body>
<form name="myform" id="myform" action="" method="POST">
    <label for="name" id="name_label">Name</label>
    <input type="text" name="name" id="name" size="30" value=""/>
    <br>
    <label for="email" id="email_label">Email</label>
    <input type="text" name="email" id="email" size="30" value=""/>
    <br>
    <input type="submit" name="submit" value="Submit">
</form>
<div id="results"><div>
</body>
</html>

流程.php

<?php
    print "Form submitted successfully: <br>Your name is <b>".$_POST['name']."</b> and your email is <b>".$_POST['email']."</b><br>";
?>

如何在 INTERNET EXPLORER 上运行此代码。非常感谢任何帮助

最佳答案

删除此行后面的“,”

email: "A valid email will help us get in touch with you.",

应该是

 email: "A valid email will help us get in touch with you."

在你的消息 block 中它是这样的

 messages: {
            name: "Please let us know who you are.",
            email: "A valid email will help us get in touch with you.",   // <<<< HERE REMOVE IT                
        },

您需要删除最后一行中的“,”(逗号),不需要。

关于php - 在 Internet Explorer 上使用 jquery 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11341724/

相关文章:

php - Yii2 - Sluggable 行为

php - 简单的评论框 php 和 mysql 不起作用

php - xmlhttp.send() 返回 404 Not Found (Ajax)

php - 在命令行中运行 Silex 应用程序

php - 在 PHP 中重置命名空间?

javascript - 用变量替换部分代码

javascript - select2 4.0 AJAX 预填充方法?

jquery - 在 JQuery 验证中避免 'async: false'

javascript - jstree 获取已检查和未检查的节点

javascript - 如何限制从键盘中选择的提前输入选项?