I saw this code in a Rails controller:
respond_to do |format|
format.js {}
I've seen this for XML and HTML formats but not for Javascript.
Is this the way you specify a return format if you use for REST, like if you use replace_html
or remote_form_for
? I know RJS templates return compiled Javascript so I'm thinking maybe this is where this code might kick in.
If you put code inside the hash symbols(format.js {}
), is that what gets send back as javascript to the browser?