Use iframe to submit form without refreshing the page

Use iframe to submit form without refreshing the page
So we introduce an embedding framework to solve this problem. The specific principle is: when the form submits data, the submission target is not set to the current page, but to an embedded frame in the current page.
First you should insert an inline frame below the body:

Copy code
The code is as follows:
<iframe style="width:0; height:0; margin-top:-10px;" name="submitFrame" src="about:blank"></iframe>

You should then set the form's target to be this embedded frame, like this:

Copy code
The code is as follows:
<form name="testform" method="post" action="apply.cgi" target="submitFrame"> <input type="submit" value="Submit"> </form>

This way we get what we need.

<<:  Example code for implementing a three-column layout with CSS, where the middle column is adaptive and changes width with text size

>>:  Several commonly used single-page application website sharing

Recommend

CSS multi-level menu implementation code

This is a pretty cool feature that makes web page...

HTML symbol to entity algorithm challenge

challenge: Converts the characters &, <, &...

jQuery plugin to achieve seamless carousel

Seamless carousel is a very common effect, and it...

CSS realizes the realization of background image screen adaptation

When making a homepage such as a login page, you ...

Detailed explanation of how to configure Nginx web server sample code

Overview Today we will mainly share how to config...

Mysql GTID Mha configuration method

Gtid + Mha + Binlog server configuration: 1: Test...

Summary of 16 XHTML1.0 and HTML Compatibility Guidelines

1. Avoid declaring the page as XML type . The pag...

Steps of an excellent registration process

For a website, it is the most basic function. So l...

How to set list style attributes in CSS (just read this article)

List style properties There are 2 types of lists ...

CSS3 animation – steps function explained

When I was looking at some CSS3 animation source ...

How to display texture at the position of swipe in CocosCreator

Table of contents 1. Project requirements 2. Docu...

MySQL concurrency control principle knowledge points

Mysql is a mainstream open source relational data...

Analysis of the use and principle of Docker Swarm cluster management

Swarm Cluster Management Introduction Docker Swar...

Summary of methods for writing judgment statements in MySQL

How to write judgment statements in mysql: Method...

Vue realizes web online chat function

This article example shares the specific code of ...