I had to mock up a demo for Intel for my work and went with _why’s Camping. However nobody on the IRC channel the other day knew how to use ajax with it. It turned out to be easy.
serve static files
Once you actually deploy your app, it will be faster and more stable to serve the static directory either directly from Apache, or with a mongrel dirhandler. Both ways bypass your static camping controller. There is an example of the mongrel dirhandler in rv version 2.
head element of your layout.
make a link
Make a link in one of your views that will call the ajax’ed action and specify the element to update with the response.
Then have your action just return a raw string instead of calling render:
class MyAction < R '/myaction/(.*)' def post param # do something with param "Mepw!" end end
Ajax.Updater will replace the element you specified with the action’s response.
Or a feral cat. Mepw.
Good catches, Evan. I’ve updated the one example on the wiki and if you decide to write up anything more about Ajax and Camping you can put a copy up there as well. http://code.whytheluckystiff.net/access/ to get an account. Thank you!