Jquery with REST

Jquery with REST

Some basic ideas:
Maps CRUD calls
$.Create   ------> POST
$.Read      ------>  GET
$.Update ------->PUT
$.Delete   ------->DELETE
all of these methods are based on the jQuery.ajax() calls

every one will have 4 parameters: URL [, data ] [, success ] [, failure ]

URL: The url of the resource, which can include a dynamically populated value surrounded by {braces}
data: (optional) The data to post to the resource, also used to populate dynamic values.
     In GET requests, data will be added to the url as query-string parameters
success: (optional) The success callback
failure: (optional) The failure callback

<script>

$(function() {
    $('button').click(function() {
        $.Read(
        'http://localhost:8080/easymarket/service/person/1',
        null,
        function(){
           alert("2222");
        },
        function(){
            alert("1111");
         }
        );
    });
});

</script>

<div data-role="content">
        <button>Read</button>
        <div id="test">test</div>
</div>

But it is useless for me right now. And the plugin is not updated.

So I decide to use the ajax directly.

references:
http://zh-cn.w3support.net/index.php?db=so&id=739598
http://developers-blog.org/blog/default/2010/04/27/JQuery-Ajax-Client-and-Jersey-Rest-JSON-Endpoint-Example
http://plugins.jquery.com/project/Rest
http://plugins.jquery.com/plugin-tags/rest

你可能感兴趣的:(jquery,REST)