title: How to asynchronously load a partial page in rails
body: <p>In creating a ruby on rails / jquery app, there's a part of a page that is time-consuming to generate. </p>
  
  <p>I want to change how the page is loaded so that most of the page loads right away, and a placeholder is reserved for the time-consuming part to load asynchronously, and be injected into the page with ajax / jquery when it is finished.</p>
  
  <p>What I have now (simplified): </p>
  
  <p>app/views/sample/show.html.erb: </p>
  
  <pre><code>&lt;div id="theResult"&gt;
      &lt;%= render :partial =&gt; 'calculate', :object =&gt; @org) %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and the partial will use some parts @org to generate some content (hitting another external REST service).</p>
  
  <p>app/views/sample/_calculate.html.erb</p>
  
  <pre><code>&lt;%
      # code to take org and turn it into content
  %&gt;
  &lt;!--...html to display results here --&gt;
  </code></pre>
  
  <p>I realize this is probably breaking proper MVC architecture rules since my partial seems to have too much logic, and would like to clean that up as well...</p>
  
  <p>So I guess I have two questions in one: (1) how do I get this to work, and (2) how should I clean this up to follow good ruby/rails/mvc practices?</p>