Use hidden iframe to implement form asynchronous commit without Ajax

Source: Internet
Author: User
Tags commit blank page

Lifting Async, the first thing to think about is Ajax, but for scenarios where it's inconvenient to use Ajax, for example, we want to upload a file using Servlet 3.0, we also need to submit some form information, how to first commit the file asynchronously, and keep the form data from being refreshed.

Here's a way to implement a form asynchronous commit using a hidden iframe:

Target property setting for form label: target= "Hidden_frame"

Add an iframe inside the form form:

<iframe name= ' hidden_frame ' id= "hidden_frame" style= ' Display:none ' ></iframe>

Therefore, after clicking the Submit button, the Servlet,servlet execution of the action will navigate to the hidden IFrame, the page will not change, and the form data remains, thus avoiding jumping to a blank page.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.