raki
raki

Reputation: 2293

HTML page submission without redirection

Is there any method to submit an html form without redirecting from the current page without using ajax?

Upvotes: 3

Views: 5197

Answers (4)

Anurag
Anurag

Reputation: 141869

Use any element that relies on external resources.

If file uploading is required

Change the target attribute of the form to the name of some hidden iframe.

If file uploading isn't required

Use any element that pulls its content from an external resource

<img src="server.php?name=JohnDoe" />
<link href="server.php?name=JohnDoe" rel="stylesheet" />
<script src="server.php?name=JohnDoe"></script>
...

But why can't you use AJAX? Note that it's now possible to upload files with AJAX as well.

Upvotes: 1

oezi
oezi

Reputation: 51797

you can set a target="" for your form - so you could submit your form to a new tab (target="_blank") or to a small, hidden iframe (target="nameofmyiframe")

Upvotes: 3

Michel
Michel

Reputation: 9440

event onSubmit what calling a function which end with return false

Upvotes: 0

meder omuraliev
meder omuraliev

Reputation: 186562

Without using ajax? An iframe. Is it recommended? No. Why can't you use ajax techniques?

Upvotes: 3

Related Questions