JQuery 3 ways to request $.post $.get $.getjson

  • 2020-03-30 02:29:20
  • OfStack

$.post,$.get, and $.getjson are the three types of jQuery requests

1. $. Get refers to the data submitted by get method. The usage: $. Get (url,data,callback)
 
$.get("../saveUser.action",{ 
'userId':123, 
'userCode':'123' 
},function(data)){} 

2. $.post refers to post submission. Generally speaking, it is relatively safe.
 
$.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 $.
 
$.getJSON("../saveUser.action?callback=?",{ 
'userId':123, 
'userCode':'123' 
},function(data)){} 

Related articles: