I think there are 2 questions here.
Question 1: Unobtrusive JavaScript. This happens at the client side.
When the browser (or client) can't understand JavaScript for some
reason then it will fall back on HTML. This is where Unobtrusive
JavaScript comes in to play. Your views are responsible for this. Some
links to help you with this:
http://www.railway.at/articles/2008/05/19/guide-to-unobtrusive-javascript-part-1
http://simonwillison.net/static/2008/xtech/
Question 2: Serving to multiple formats. Could be js, xml, html or
whatever. In other words this is being RESTful. Your controllers are
responsible for this. You should be using respond_to block extensively
and serve the content according to the incoming request.
-subbu