title: Ruby on rails: how to update an div with partial without making an ajax call to server
body: <p>I want to update an div with contents of a partial when a user clicks on a radio button. Now the contents of that partial are static html (a form may be). So because I do not have any data to fetch from the server I am reluctant to make an ajax call to server just to fetch that partial and update the div. Here is what I have tried. </p>
  
  <pre><code> function loadControlPanel(type)
        {
          alert(type);
          $(controlPanelDiv).appendChild("&lt;%=  render :partial =&gt; 'layouts/agency_selection' %&gt;");
        }
  
  
  &lt;input type="radio" name="view" value="agencies" onClick ="loadControlPanel(this.value)" /&gt; Agencies
  </code></pre>
  
  <p>But this doesn't work because the render  replaces the entire partial there along with the new lines which throws javascript errors in the <code>function loadControlPanel(type)</code>.</p>
  
  <p>Is there any way to overcome this? or some other simpler solution?</p>
  
  <p>Thanks
  Shaunak</p>