Using a Javascript RPC client to write code more quickly

Performing remote procedure calls (RPC) by hand can entail and lot of boiler-plate code, and the possibility of making a lot of mistakes that can be troublesome to debug. Unfortunately there are many benefits to using RPC in the form of AJAX to write web applications.

By using an standard RPC protocol a lot of this boiler-plate code can be eliminated making one's life a great deal easier. This of course assumes that there are the necessary tools to support this protocol in the environments were you want to work.

Python (and django) together with tools for the XML RPC protocol. This sample code shows the use of this protocol with javascript talking to a standalone python rpc server and and rpc server embedded within a django application.

This approach is very much a convenience function approach rather than a framework approach. For large projects it might make sense to live within a framework that makes this sort of thing terribly easy, at the expense of making you do more within the confines of the framework.

Download

Examples of using a javascript rpc client to talk to python server easily (standalone and in django)