Home > Web Front-end > JS Tutorial > Simple examples of get and post in jquery_jquery

Simple examples of get and post in jquery_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:01:29
Original
1111 people have browsed it

Example:

test.html
Page reference


The following is a function taken from the network:

The post method is as follows:

Copy code The code is as follows:

function test(access_url, tipE){

$.post(access_url,{
first: "test1", second: "test2"
}, function(data){
if(data.success){
               $(' #' tipE).html('Processed successfully'); 🎜>          },'json'
) )
}


If you want to use the get method, just replace post with get. It’s quite simple!

The data value in this function is the value returned by the server and is in JSON format. Of course, other types can be used here, such as text, xml, etc.


The return value from the server is in JSON format, such as: {success:true, msg:"Test successful"}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template