jQuery 寻找一个非常简单的jquery电子邮件提交表单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2175522/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 12:55:57  来源:igfitidea点击:

looking for a very simple jquery email submission form

jquery

提问by Joel

I'm just looking for a form that someone will put in their email and submit and that's it. They stay on the same page with ajax, and I get emailed the submission. I don't need to save it in a database. I would like to perform basic check to validate that there is a "2" and a "." in the address and there will be text put in a div saying "your email was sent". but that is all.

我只是在寻找一个表格,有人会将其放入他们的电子邮件中并提交,仅此而已。他们与 ajax 保持在同一页面上,我收到了提交的电子邮件。我不需要将它保存在数据库中。我想执行基本检查以验证是否有“2”和“.”。在地址中,将在 div 中显示“您的电子邮件已发送”的文本。但仅此而已。

Anyone seen anything like that? I saw a few, but they all just input the info to a database.

有人见过这样的吗?我看到了一些,但他们都只是将信息输入到数据库中。

I'm using jquery.

我正在使用 jquery。

Thanks! Joel

谢谢!乔尔

回答by Tahir Akhtar

Just use the jQuery ajax form submission methods and handle the email sending in a server-side script.

只需使用 jQuery ajax 表单提交方法并处理在服务器端脚本中发送的电子邮件。

You can not send emails directly from JavaScript. You will have to submit the form to your own or a third-party server to get the email sent out. Also note that AJAX won't work with third-party servers due to cross-domain security restriction but you achieve same effect by using and iframe to submit the form.

您不能直接从 JavaScript 发送电子邮件。您必须将表单提交到您自己的或第三方服务器才能发送电子邮件。另请注意,由于跨域安全限制,AJAX 将无法与第三方服务器一起使用,但您可以通过使用 iframe 提交表单来实现相同的效果。

回答by Pantherius

However, it is an old thread, but there is no accepted solution. You can simply create a HTML form with CSS, then extend it with some jQuery that will handle the validation and the form request. If you would like to send email notification about the submission, you need to manage it via PHP. The following free plugin provides all of these options, that has been mentioned above.

但是,这是一个旧线程,但没有公认的解决方案。您可以简单地使用 CSS 创建一个 HTML 表单,然后使用一些 jQuery 对其进行扩展,以处理验证和表单请求。如果您想发送有关提交的电子邮件通知,则需要通过 PHP 进行管理。以下免费插件提供了上面提到的所有这些选项。

Free Simple Signup Form

免费的简单注册表单

You may also check out this list, that contains 10 different jQuery Signup Forms:
10 jQuery Signup Form Demos

您还可以查看此列表,其中包含 10 个不同的 jQuery 注册表单:
10 个 jQuery 注册表单演示