That makes sense. When your page loads, the value of @deals is inserted in
the JavaScript that is sent to the client. As you noticed, since your
JavaScript code never makes a request back to the server, it just keeps
calling replaceWith on the value of the original @deals.
The easiest way is probably to have some type of update action that responds
to JS. Then in your view, you can render the newly refreshed @deals.
You''ll
also need to update your JavaScript to hit this action on the server and
update your DOM element with the result. Here are some rough code examples.
In your controller:
def some_update
@deals = Deal.all
end
In some_update.js.erb:
<%= escape_javascript(render(:partial => @deals)) %>
Then change your JavaScript to hit some_update and use the result of
some_update:
onPullDown: function () {
setTimeout(function () {
.ajax({
url: ''controller/some_update.js'',
success: function(data) {
$(''#thelist'').replaceWith(data);
myScroll.refresh();
}
});
});
},
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.