Yet another JSON-RPC plugin
Pull request Compare This branch is 5 commits ahead of devinus:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


jQuery JSON-RPC Plugin

A JSON-RPC 2.0 implementation for jQuery.
JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol.
Read more in the <>

  $.jsonrpc(url, data [, callbacks] [, debug]);

  where data = {method:'methodname', params:['positional', 'parameters']}
  or data = {method:'complexmethod', params:{named:'parameters', works:'too!'}}
  and callbacks = {success: successFunc, fault: faultFunc, error: errorFunc}

  Setting no callback produces a JSON-RPC Notification.
  'data' accepts 'timeout' keyword too, who sets the $.ajax request timeout.
  Setting 'debug' to true prints responses to Firebug's

  // A RPC call with named parameters
    url : '/rpc', 
    method : 'createUser',
    params : {name : 'John Smith', userId : '1000'}
  }, {
    success : doSomething(response),
    fault : handleFault(response, errordata),
    error : handleError(request, status, error);

  // A Notification 
    url : '/rpc', 
    method : 'notify',
    params : {action : 'logout', userId : '1000'}

  // A Notification using console to debug and with timeout set
    url : '/rpc', 
    method : 'notify',
    params : {action : 'logout', userId : '1000'},
    debug : true,
    timeout : 500,