Yet another JSON-RPC plugin. JSON-RPC 2.0 and JSON-RPC over WebSocket Support
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 8 commits ahead of veged: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
  $.jsonrpc('/rpc', {
    method : 'createUser',
    params : {name : 'John Smith', userId : '1000'}
  }, {
    success : doSomething(response),
    fault : handleFault(response, errordata),
    error : handleError(request, status, error);

  // A Notification 
  $.jsonrpc('/rpc', {
    method : 'notify',
    params : {action : 'logout', userId : '1000'}

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