简体   繁体   English

关于表单标签的动作属性

[英]Regarding action attribute of form tag

hii i want to send the information to the server when someone clicks on submit button of the form tag, but do not want to refresh or go to another url. 您好,我想在有人单击表单标签的“提交”按钮时将信息发送到服务器,但不希望刷新或转到另一个URL。

i don't know about AJEX do i need it for this purpose?? 我不了解AJEX是否为此目的需要它??

As dragon66 suggests in a comment, you can use an inline frame: 正如Dragon66在评论中建议的那样,您可以使用嵌入式框架:

<form action="..." target="form-results">
...
</form>
<iframe name="form-results"></iframe>

The inline frame will display the data sent by the server as distinct from the page content but placed inside it. 内联框架将显示服务器发送的与页面内容不同的数据,但放置在其中。 Depending on the server's response, you could have just a small box that will contain information about successful operation. 根据服务器的响应,您可能只有一个小盒子,其中包含有关成功操作的信息。

You can set the dimensions (width and height) of the inline frame using HTML attributes or using CSS. 您可以使用HTML属性或CSS设置嵌入式框架的尺寸(宽度和高度)。 If you wish to hide the inline frame, you can set width=0 height=0 frameborder=0 in HTML and/or iframe { display: none} in CSS 如果您希望隐藏内联框架,则可以在HTML和/或CSS中将iframe { display: none}设置为width=0 height=0 frameborder=0

Yeah, you will need ajax for it. 是的,您需要使用ajax。 Refer these link. 请参考这些链接。

http://be.twixt.us/jquery/formSubmission.php . http://be.twixt.us/jquery/formSubmission.php

http://jquery.malsup.com/form/#ajaxForm http://jquery.malsup.com/form/#ajaxForm

Here are good examples how to submit form using ajax for formsubmission. 这是一个很好的示例,说明了如何使用ajax提交表单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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