title: Using rails and ajax to dynamically render content.
body: <p>I am really in a bind on how to get this last step of my app done. </p>
  
  <p>I want to dynamically replace the main content without needing to refresh the page. </p>
  
  <p>The application.html.erb looks like this:</p>
  
  <pre><code>&lt;div id="wrapper"&gt;
          &lt;!-- &gt;&lt;div id="headcontainer"&gt;
              &lt;header&gt;
              &lt;/header&gt;
          &lt;/div&gt; --&gt;
          &lt;div id="maincontentcontainer"&gt;
              &lt;div id="maincontent"&gt;
                  &lt;div class="section group"&gt;
                      &lt;div class="col span_1_of_7"&gt;
                          &lt;%= render :partial =&gt; "shared/menu" %&gt;
                      &lt;/div&gt;
                      &lt;div id="replace"&gt;
                          &lt;%= yield %&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>I have my menu partial which when clicked I want to dynamically replace the content of the #replace div</p>
  
  <pre><code>&lt;ul class='kwicks kwicks-vertical'&gt;
      &lt;li id='panel-1'&gt;&lt;%= link_to_unless_current image_tag('keyIssues.png'), :remote =&gt; true %&gt;&lt;/li&gt;
      &lt;li id='panel-2'&gt;&lt;%= link_to_unless_current image_tag('pollVsLeader.png'), :remote =&gt; true  %&gt;&lt;/li&gt;
      &lt;li id='panel-3'&gt;&lt;%= link_to_unless_current image_tag('keyBubble.png'), :remote =&gt; true  %&gt;&lt;/li&gt;
      &lt;li id='panel-4'&gt;&lt;%= link_to_unless_current image_tag('dataSource.png'),  :remote =&gt; true  %&gt;&lt;/li&gt;
      &lt;li id='panel-5'&gt;&lt;%= link_to_unless_current image_tag('group14.png'), :remote =&gt; true  %&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I had some Jquery that I was using to remove the div and replace it.. but it is replacing the div with the fill contents of the page.. a page within a page here is some of the code:</p>
  
  <pre><code>$(function(){
    $('#panel-1').click(function(){
      $("#remove").remove();
      $.get('../key_issues/index.html', function(html){
        $('.col.span_6_of_7').remove();
        $('.section.group').append(html);  
      });
    });
  });
  </code></pre>
  
  <p>I have tried the ajax-rails gem but i cant get that to work either.. can someone offer some advice please?</p>