简体   繁体   中英

How can I prevent the page from reloading after posting a form?

Normally, I'd use AJAX for this, but the purpose of the form is to upload a file, which AJAX can't do.

Is there a way to let the form submit normally, but catch the response (JSON/XML or similar) and handle it in javascript without the page refreshing/redirecting?

添加一个隐藏的iframe,然后使用target属性将表单发布到iframe。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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