The
- $.get () method
Generally uses the Get method to get the values inside the database.
$ (" button "). Click (function () { var url= "background processing the address of the data? ID=89&NAME=III"; $.get ("url", function (data) { $ ("Ul>li"). Append ( data); }); |
- $.post () method
Post method has the meaning of submitting the data to be processed to the specified resource, need to submit
$ ("button"). Click (function () { var url= "The address of the background processing this data"; $.post ("url", { id:89, Name: "III" }, function (data,status) { $ ("Ul>li"). Append (data); }); }); |
|
- $.ajax () method
This method is mainly used to change the text elements within the DIV tag.
$ ("button"). Click (function () { var url= "The address of the background processing this data"; $.ajax ({url: "url", success:function (Result) { $ ("#div1"). HTML (result); }}); }); |
- $.getjson () method
Use HTTP GET request load from server JSON the encoded data
$ (function () { $ ("#homepage"). Load (function () { Rssmasklayer.show ();//the picture being loaded Rssloadbox.show ();//Load Box $.getjson ("Http://localhost:8084/api/article/list", function (JSON) { Rssmasklayer.close (); Rssloadbox.close (); $ ("#homepage ul"). Mapitem (JSON);// $ ("#homepage ul"). Find ("Li"). Click (Function () { $.getjson ("http://localhost:8084/api/article/view?id=" +$ (This). attr ("Dataid"), function (JSON) { $ ("#articleviewpage"). Mapjson (JSON); }); }); }); }). Load (); }); |
Reference: http://www.runoob.com/jquery/jquery-ref-ajax.html
Difference: http://www.runoob.com/jquery/jquery-ajax-get-post.html
Http://www.runoob.com/tags/html-httpmethods.html
$.get/$.post/$.ajax/$.getjson