简体   繁体   中英

performing php script without reloading the page

<form action ="send.php" name ="userdetails" onsubmit="display(); return false;">

although this does perform the send.php script, it loads the send.php page and the content of the current page is lost.

I need to perform the following, once the form is submitted - an email should be sent. However the current page is not to be changed. What is the best way to accomplish this? Thank you

Setting a value for action="..." will always redirect you to a new page.

For what you want to do, AJAX is perfect. It allows you to run a PHP script without leaving the page you are on. I would check out jQuery's AJAX capabilities .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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