为什么我的提交表单将我带到我的php页面?

为什么我的提交表单将我带到我的php页面?,php,javascript,jquery,ajax,forms,Php,Javascript,Jquery,Ajax,Forms,(我没有意识到在这之前我已经发布的帖子可以被编辑和重新打开。对这个过程感到困惑…) 当我点击发送表单时,电子邮件被正确发送,但随后我被发送到显示数字0的php页面。我不明白为什么会这样。以下是(大部分)完整代码: <form id="contactForm" method="post" action="js/formCheck.php"> <div class="formCol"> <label>Email:</label>

(我没有意识到在这之前我已经发布的帖子可以被编辑和重新打开。对这个过程感到困惑…)

当我点击发送表单时,电子邮件被正确发送,但随后我被发送到显示数字0的php页面。我不明白为什么会这样。以下是(大部分)完整代码:

<form id="contactForm" method="post" action="js/formCheck.php">
    <div class="formCol">
        <label>Email:</label>
        <input type="email" id="formEmail" name="email" autocomplete="off" placeholder="Your email address..." required/>
    </div>
    <div class="formCol midCol">
        <label id="floatMsg">Message (350 chars):</label>
        <textarea id="formMessage" name="message" rows="5" cols="40" maxlength="350" placeholder="What have you got to say?" required></textarea>

    </div>
    <div class="formCol lastCol">
        <input type="submit" class="submit-btn" name="submit" value="Send" />
    </div>
</form>

在表单重置后添加
返回false
。表单id也是
联系人表单
而不仅仅是
表单

<script>
    $(document).ready(function() {
        $('#contactForm').ajaxForm(function() {
            alert("Thank you for your comment! I will receive it shortly and get back to you as soon as possible.");
            document.getElementById("form").reset();
            return false;
        });
    });
</script> 

$(文档).ready(函数(){
$('#contactForm').ajaxForm(函数(){
提醒(“谢谢你的评论!我会很快收到并尽快回复你。”);
document.getElementById(“表单”).reset();
返回false;
});
});

在表单重置后添加
返回false
。表单id也是
联系人表单
而不仅仅是
表单

<script>
    $(document).ready(function() {
        $('#contactForm').ajaxForm(function() {
            alert("Thank you for your comment! I will receive it shortly and get back to you as soon as possible.");
            document.getElementById("form").reset();
            return false;
        });
    });
</script> 

$(文档).ready(函数(){
$('#contactForm').ajaxForm(函数(){
提醒(“谢谢你的评论!我会很快收到并尽快回复你。”);
document.getElementById(“表单”).reset();
返回false;
});
});

在表单上
action=“js/formCheck.php”
这是php的权利?document.getElementById(“表单”)元素中没有声明“表单”id。编辑原始问题,不要问两次。在表单上
action=“js/formCheck.php”
这是php的权利?document.getElementById(“表单”)您的元素中没有声明“表单”id。编辑原始问题,不要问两次。即使更改为正确的表单id,我仍然存在问题。即使更改为正确的表单id,我仍然存在问题。
<script>
    $(document).ready(function() {
        $('#contactForm').ajaxForm(function() {
            alert("Thank you for your comment! I will receive it shortly and get back to you as soon as possible.");
            document.getElementById("form").reset();
            return false;
        });
    });
</script>