HTML page submission without redirection

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 12:26:20

问题


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


回答1:


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")




回答2:


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




回答3:


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.




回答4:


event onSubmit what calling a function which end with return false



来源:https://stackoverflow.com/questions/3333808/html-page-submission-without-redirection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!