Home > Web Front-end > JS Tutorial > 3 request methods of jQuery $.post, $.get, $.getJSON_jquery

3 request methods of jQuery $.post, $.get, $.getJSON_jquery

WBOY
Release: 2016-05-16 16:54:09
Original
1185 people have browsed it

$.post, $.get, $.getJSON are the three request methods of jQuery

1. $.get is the get method to submit data, usage: $.get(url,data,callback), for example:

Copy code The code is as follows:

$.get("../saveUser.action" ,{
'userId':123,
'userCode':'123'
},function(data)){}

2. $.post is post submission , generally speaking, it is relatively safe, usage: $.post(url,data,callback), example:
Copy code The code is as follows:

$.post("../saveUser.action",{
'userId':123,
'userCode':'123'
}, function(data)){}

3. $.getJSON is also submitted according to the get method, but $.getJSON supports cross-domain, and its usage is basically the same as $.get and $.post $.get(url,data,callback), example:
Copy code The code is as follows:

$.getJSON("../saveUser.action?callback=?",{
'userId':123,
'userCode':'123'
},function(data)){}
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template