开发者

Email form results with jquery?

Can anyone show 开发者_开发知识库me a script or example of a form results being emailed with submit? Does jquery have any advantage with this?

Erik


jQuery might be the magical unicorn of scripting frameworks but even that isn't able to actually send an email.

Typically you would serialise your form values and pass these back to some server-side method to process; be that a PHP script, .Net method or whatever.

If you HAVE to have an email pop up when the user clicks a link or button, you might get some of the way by employing a (rather unattractive) approach like this.

But the bottom line really is, "Please don't".


Typically a website that sends an email as a result of submission will do this emailing on the server side (where a suitably configured SMTP client exists). You can use jQuery to validate the form on the client side (although you will still need to do server side validation) and to submit the form, which will POST it to program / script on the server side that will email whatever text it should email.


It might have some advantages like client side validation and "nice effects" or no refresh after send.

You must no that jquery isnt the one "sending the email" you might want to do this with php or any other methods just google email form or similar. :)

Here is a good example:

http://trevordavis.net/blog/ajax-forms-with-jquery/

Good luck!


the only advantage jQuery has with submitting the results is that you don't have to post to the page that actually does the submissions. What's nice about that is that the page doesn't refresh, and the user doesn't leave what he's currently doing. You can do a jQuery.ajax() POST to the email script, on the server, to process the email submission, and the user will still be on the page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜