From: Eivind Eklund Date: 2007-11-21T20:54:21+09:00 Subject: Re: AJAX without Rails On Nov 20, 2007 5:34 PM, Miki Vz wrote: > Hi, I'm pretty new to Ajax. > > I need to do some simple web interfaces for some project I have. A > friend told me Rails was a bit to much for what I need, so I'm using > eruby and markaby, and I'm pretty happy, and things are kept pretty > sweet and simple for now. > > However I would like to use a little of Ajax, what is the best way to go > about it? How do Ajax work for ruby? seems like rails has support for > Ajax that makes it simple. Can i have the same for my eruby scripts > without having to install any MVC system like Rails or anything? AJAX is fairly simple, at least as long as you ignore the "XML" part of it and use HTML or JSON (Javascript Over Network) to deal with it. The very easiest way to do AJAX is to just have a new command handler/new script that output the HTML you want to replace with, and do something like this (example with the jQuery library): That's simple AJAX. If you want to include JSON data and do DOM manipulation directly, you can do JSON calls like this: $.getJSON("/autodb/ajaxapi.wa2",{_cmd: cmd, xBoatType: xBoatType, xBrand: xBrand, xModel: xModel}, function(j) { var elm = document.forms['search'].elements[id]; RemoveChildren(elm); for (var i=0; i. Remember to escape your single-quotes; they almost certainly WILL show up even if you're sure they won't. (Or at least they did for us...) Hope that helped a bit. Eivind.