Created
December 20, 2011 05:59
-
-
Save bvsatyaram/1500484 to your computer and use it in GitHub Desktop.
Load Content on Page Load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Assuming that jQuery is already loaded */ | |
$(document).ready(function() { | |
/* Ajax Content Load */ | |
$('.ajax_content_loader').click(); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%# *Some thing else %> | |
<div id="activity_feed"> | |
<%= ajax_content_loader(load_activity_path) %> | |
</div> | |
<%# *Some thing else %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#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