Say I have an application#search method that I would like to respond to AJAX requests. Inside of my JS view (app/views/application/search.js.erb) I would like to render the HTML view:
$("#content").html( escape_javascript( render( :action => 'search', :format => 'html' ) ) );
$("#title").html( "Title" );
I know I could move things into a partial and render that in both the HTML and JS views, but the problem is I have many different actions that need to respond in this way and I'd prefer not creating a bunch of 1-line view files that just render a partial.
Is there any way to explicitly render an action with a specific format and grab the different parts of content_for as well? So for the above example, I could set #title to the HTML returned with content_for :title or something.