Created
December 2, 2012 12:52
-
-
Save StevenLangbroek/4188501 to your computer and use it in GitHub Desktop.
Ajaxify Calendar
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
$(function(){ | |
$('.ajax_link').on('click', function(e){ // catch the click, and bind that click-event to the variable "e" | |
e.preventDefault(); // stop the event from firing (so user doesn't get forwarded to the actual link) | |
var elem = $(this), | |
link = elem.attr('href'), | |
target = elem.attr('rel'); | |
$.get(link, function(data){ // do a GET-request | |
$(target).html(data); // put the results in the target-element | |
}); | |
}); | |
}); |
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
<!-- your link, mind the rel-attribute --> | |
<a class="ajax_link" href="{day_path='events'}" rel="#event_container">{day_number}</a> | |
<div id="event_container" class="colThree_event_container"> | |
<p>Initial content here</p> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment