Two examples of the use of the a tag in HTML post request are as follows: 1. Use ajax to initiate a POST request The HTML code is as follows: <a href="https://www.jb51.net/" class="a_post">Initiate POST request</a> The JQuery code is as follows: $(".a_post").on("click",function(event){ event.preventDefault(); // Make the method of a invalid, that is, it cannot be adjusted to the URL in href (https://www.cnblogs.com/) $.ajax({ type: "POST", url: "url address", contentType:"application/json", data: JSON.stringify({param1:param1,param2:param2}), //parameter list dataType:"json", success: function(result){ //Operation after request is correct}, error: function(result){ //Operation after request failure} }); }); 2. Use form to initiate POST request <form id="_form" method="post" action="target"> <input type="hidden" name="name" value="value" /> <a onclick="document.getElementById('_form').submit();">Click Submit</a> </form> Summarize This is the end of this article about the two usages of the a tag in html post request. For more relevant content about the a tag in html post request, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! |
<<: Various ways to modify the background image color using CSS3
>>: Introduction to network drivers for Linux devices
In the latest version of Ubuntu, users no longer ...
Problem Description In the login page of the proj...
The first time I installed MySQL on my virtual ma...
First, install PHP5 very simple yum install php T...
Preface When using Docker in a production environ...
This article shares with you a detailed tutorial ...
Table of contents Logical Layering Separate busin...
Timer Effects: <div> <font id='timeC...
I wonder if you have ever thought about this ques...
Make a note so you can come back and check it lat...
mysql copy one table column to another table Some...
Table of contents Preface Why does limit deep pag...
1. What is MySQL master-slave synchronization? Wh...
This article shares the specific code for using j...
Find mirror We can search for images from the Doc...