title: How to request an html page using an ajax request in Rails 3?
body: <p>I'm trying to Rails to render the an <code>.html.erb</code> template through an ajax request under certain conditions. By default I keep getting back the <code>.js.erb</code> file when I send an ajax request.</p>
  
  <p>I won't get into why I'm doing this, but I was wondering if there's either a way to specify when I'm sending the request through ajax that I'd like html content back rather than js, OR alternatively, if there's a way to refactor the following in Rails 3.1:</p>
  
  <pre><code>respond_to do |format|
    format.html
    format.js do
      if params[:page].nil?
        render "home.html.erb"
      else
        render "home.js.erb"
      end
    end
  end
  </code></pre>
  
  <p>Thanks!</p>