我有我的网站发送电子邮件的联系表。我希望它在提交时不刷新页面,但要发送电子邮件和成功消息。我的表单就像我想提交我的联系人从没有页面刷新
<form method="post" id="contactform" enctype="multipart/form-data">
<input class="contactusfeild" style="width:222px;" name="sendername" type="text" placeholder="Your Name" required>
<input class="contactusfeild" name="senderemail" style="width:222px;" type="email" placeholder="Your Email" required >
<textarea name="sendermessage" class="contactusfeild" type="text" placeholder="Your Message Here" style="width:220px; max-width:220px; height:100px; max-height:100px; padding-top:10px;" required ></textarea>
<input class="button" style="border:none;" type="reset" value="Clear" /><input name="contactcozmuler" class="button" style="border:none; margin " type="submit" id="submit_btn" value="Send" />
</form>
您还没有在SO上搜索过。无论如何尝试这个https://stackoverflow.com/questions/1960240/jquery-ajax-submit-form/1960245#1960245 – anurupr
可能重复[提交表单,而不提交按钮,没有页面刷新?](http:// stackoverflow。 com/questions/12386999/submit-a-form-without-submit-button-and-without-page-refresh) –
你将不得不使用AJAX。具体来说,你需要做一个POST请求。看看这个答案:http://stackoverflow.com/a/1200312/1487730 – krisk