使用Action =" file.php"提交表单没有重新加载? [英] Submit Form With Action="file.php" With No Reload?
本文介绍了使用Action =" file.php"提交表单没有重新加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的网站制作表单。
I'm working on a form for my website. The markup for the form tag looks like:
<form method="post" action="contactengine.php">
表单发送一封电子邮件给我使用action =contactengine.php用户提交它。然而,由于我有页面布局,当用户提交表单时,我无法重新加载页面。我该如何解决这个问题?
The form sends an email to me using action="contactengine.php" with the form information when a user submits it. Because of the page layout I have, however, I can't have the page reload when a user submits the form. How can I work around this issue?
推荐答案
您能够使用javascript + jquery吗?使用jquery进行异步发布非常简单。
Are you able to use javascript + jquery? Posting asynchronously is fairly simple with jquery.
$('#formid').submit(function({ //listens for form submission
$(this).preventDefault(); //stops the submission
$.post('actionPage.php', $(this).serialize, function(response){
//posts the data to actionpage.php, with the form data, and then runs a function handling the response.
});
}));
这篇关于使用Action =" file.php"提交表单没有重新加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文