Skip to content

Instantly share code, notes, and snippets.

@bvsatyaram
Created December 20, 2011 05:59
Show Gist options
  • Save bvsatyaram/1500484 to your computer and use it in GitHub Desktop.
Save bvsatyaram/1500484 to your computer and use it in GitHub Desktop.
Load Content on Page Load
/* Assuming that jQuery is already loaded */
$(document).ready(function() {
/* Ajax Content Load */
$('.ajax_content_loader').click();
})
module ApplicationHelper
def ajax_content_loader(url)
link_to(image_tag("/images/layout/ajax-loader.gif"), url, :remote => true, :class => "ajax_content_loader")
end
end
<%# *Some thing else %>
<div id="activity_feed">
<%= ajax_content_loader(load_activity_path) %>
</div>
<%# *Some thing else %>
$('#activity_feed').html('<%= escape_javascript render(:partial => "activities/feed", :locals => {:activities => @activities}) %>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment