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 ?

4 Comments:

Blogger ROhan said...

awesome man !!

Must have had an awesome pair with you when you were coding this. ;-)

2:52 AM  
Blogger Supreeth Subramanya said...

Dude Kaaru,
This tech stuff is too tangential to what I'm into! Couldn't get anything out of it (apart from a tiny hint that you'd intelligently pulled off something).

Way to go (actually a long way to go before I can follow your works :-))

10:36 PM  
Blogger karthik c said...

oh nothing too intelligent man.... just a small bit of automation, which i thought would help other people doing the same thing, but as i mentioned the basic problem was already solved in the new version of rails :-)

4:34 AM  
Blogger Jagadish said...

bhale kumaara..shabhash !!

good idea lo..nangu ond saavira ajax calls maadi maadi thale keetogide....

2:01 PM  

Post a Comment

<< Home