javascript - Re-rendering Reloading Partial in Rails -
i have list of links posts on page. when clicked, link triggers lightbox partial showing post.
my problem:
1.) user interacts lightbox , changes information post (favoriting, unfavoriting).
2.) user closes lightbox
3.) user reopens lightbox clicking on link again. lightbox information not updated changes user made.
4.) if user refreshes whole page ctrl+r , clicks on lightbox, lightbox reflect new changes.
lightbox using fancybox.
link lightbox
<a class="fancyboxentry" rel="entries" href="#entryshow<%= thispost.id%>" onclick ="renderentry<%=thispost.id%>()"> <%= image_tag(thispost.content_2)%> </a>
dummy div hold loaded partial.
<div id="entryshow<%= thispost.id %>"> </div>
renderentry function:
<script> function renderentry<%= thispost.id%>() { $('#entryshow<%= thispost.id%>').html("<%=escape_javascript(render(:partial => 'posts/show', :locals => {:id => thispost.id})).html_safe %>");} </script>
how can partial re-render, means pulling new information database (checking whether favorited, new comments, etc) every time link clicked? current links seem cache old information until page refreshed.
whether information saved in database ? if main page have information row ,then again may changing in table, please inspect steps while executing code.
Comments
Post a Comment