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

Tutorial on installing nginx in Linux environment

Table of contents 1. Install the required environ...

Vue implements upload component

Table of contents 1. Introduction 2. Ideas Two wa...

How to change the default character set of MySQL to utf8 on MAC

1. Check the character set of the default install...

Do you know how many connections a Linux server can handle?

Preface First, let's see how to identify a TC...

Detailed explanation of Docker usage under CentOS8

1. Installation of Docker under CentOS8 curl http...

How to install openjdk in docker and run the jar package

Download image docker pull openjdk Creating a Dat...

One question to understand multiple parameters of sort command in Linux

The sort command is very commonly used, but it al...

CSS writing format, detailed explanation of the basic structure of a mobile page

1. CSS writing format 1. Inline styles You can wr...

Installation method of mysql-8.0.17-winx64 under windows 10

1. Download from the official website and unzip h...

Solution to the problem of repeated pop-up of Element's Message pop-up window

Table of contents 1. Use 2. Solve the problem of ...

Problems with using wangeditor rich text editing in Vue

wangEditor is a web rich text editor developed ba...