Email Us! answers AT tanabi PERIOD com or use the form:

Tanabicom, LLC is a company dedicated to providing custom software solutions to your needs. If you need work done, use the contact form to the left to get in touch. No project is too big or too small -- we want to help you make it happen!

We are located in Raleigh, North Carolina though we gladly service customers anywhere in the world.

jQuery: JSON RPC

This is a JSON-RPC server, specifically made to work with the Zend Framework JSON RPC Server. The Zend Framework JSON-RPC server is mildly off spec, and therefore this may not work with other JSON-RPC servers.

This JSON-RPC client polls the server for the available methods, and then creates an object with those methods that can then be used. Let’s use the Zend Framework example of the Calculator class. Assume you just copy and pasted the example code from the link above to ‘rpc.php’. You could write the following javascript code:

var client = jQuery.Zend.jsonrpc({url: ‘rpc.php’});
alert(client.add(2,2));

And it’ll just work. Pretty simple really.

NEW! MANY enhancements have been added. Namespace support, async requests, async reflections, and now the ability to cache or build SMDs so that you don’t need the initial request to the server (and the server does not have to expose all methods available if that is not desired).

EVEN MORE NEW! Async calls have been made much more robust, and you can now have per-method callbacks. See the example index.html file that comes with the zip for more details.

My JSON-RPC server relies upon the json2.js file from JSON.org. Click the link below to download all the pertinent source with examples.

Download now!

published: Mon, 27 Feb 2012 19:03