JavaScript REST client Library

Amir Arad picture Amir Arad · May 28, 2009 · Viewed 218.6k times · Source

Is there a JavaScript library which allow me to perform all the REST operation like (GET, POST, PUT and DELETE over HTTP or HTTPS)?

Answer

aleemb picture aleemb · May 28, 2009

You don't really need a specific client, it's fairly simple with most libraries. For example in jQuery you can just call the generic $.ajax function with the type of request you want to make:

$.ajax({
    url: 'http://example.com/',
    type: 'PUT',
    data: 'ID=1&Name=John&Age=10', // or $('#myform').serializeArray()
    success: function() { alert('PUT completed'); }
});

You can replace PUT with GET/POST/DELETE or whatever.