开发者

Display success message upon form submission

I have a one-field HTML form on my website (used for inputting visitors开发者_如何学Python' e-mail addresses). The form's "action" is to post to update.php, which is connected with my MySQL database, so the e-mails just drop right in. Upon submitting the e-mail address put into the form field, the user is redirected to update.php, which displays a success message that I'd included in the PHP code.

Basically what I need to know is: how do I keep from redirecting the user to the update.php page, and instead, display a success message somewhere on the same page (e.g.: underneath or beside the form), so the user is staying on the same page and the whole thing looks and functions much more sexy?


You would not use a FORM post, but instead an Ajax request.

Popular direction around here would be to add jQuery to your page.

see here: http://jquery.com/

and the first link on google for jquery ajax form submit: http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜