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