Gaurav Agrawal
Gaurav Agrawal

Reputation: 13

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.

i don't know about AJEX do i need it for this purpose??

Upvotes: 0

Views: 159

Answers (2)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201538

As dragon66 suggests in a comment, you can use an inline frame:

<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. 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

Upvotes: 1

Nishu Tayal
Nishu Tayal

Reputation: 20830

Yeah, you will need ajax for it. Refer these link.

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

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

Here are good examples how to submit form using ajax for formsubmission.

Upvotes: 0

Related Questions