Sunday, April 02, 2006

a useless rails plugin

The Useless Ajax Mux-Demux plugin for Rails allows you to multiplex a bunch of ajax requests into a single one. These requests will be disptached on the server and the results collected as a single JSON object. This makes it very easy to update multiple sections of a page using a single ajax call :-)

Its always disheartening to find out that your new idea has already been implmented.... kini and me came up with this little idea while working on a personal rails project..... so we went ahead and spent a couple of nights implenting it, only to find out that the new rails version has already solved the problem.

Anyway, thought we might as well put it up, you never know what other palces people might need to multiplex and de-multiplex ajax requests.


Here's the code you need to update multiple sections of a page using a single ajax call:

new Ajax.MuxDemux([
{container: 'tag_cloud', url:'/tags/show_cloud'},
{container: 'book_details', url:'/book/details/10?level=3'},
{container: 'book_header', url:'/book/header'}
])

simple... isin't it ?