JQuery Rest
https://github.com/jpillora/jquery.rest/
Summary
A JQuery plugin for easy consumption of RESTful APIs
Downloads
- Development Version
- Production Version
File Size Report
Original: 10314 bytes.Minified: 5920 bytes.Gzipped: 1376 bytes.
Features
- Simple
- Uses jQuery Deferred for asynchonous chaining
- Basic Auth Support
- Helpful Error Messages
- Memory Cache
- Cross-domain requests with Xdomain
Demobasic Usage
- Create a client.
- Construct your API.
- Make requests.
First setup your page:
<!--JQuery--><ScriptSrc="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script><!--jQuery rest --><script src=" http://jpillora.com/ Jquery.rest/dist/1/jquery.rest.min.js"></script><!--warning:i advise not using the this link, Instead download and host this library on your own server as GitHub have download limits-->< script>
> //Examples go here ... </script>
Hello Jquery.rest
var client=New $. Restclient ('/rest/api/'); Client. Add (' foo'); Client. foo. read (); //get/rest/api/foo/client. Foo. Read (a); get/rest/api/foo/42/client. Foo. Read (' Forty-two'); get/rest/api/foo/forty-two/
Retrieving Results (Uses jQuery ' s $. Deferred)
var client=New$. Restclient ('/rest/api/‘);Client.Add' Foo‘);var request=client. foo. read (); //get/rest/api/foo/request. Done (function (data, textstatus, xhrobject) {alert ( ' I have data: ' + data);}); //OR simply:client. Foo. read (). done (function (data) {alert ( Span class= "pl-s" > "I have data: ' + data);
For more features and examples, see:
https://github.com/jpillora/jquery.rest/
JQuery Rest Client Library