This may sound "silly" but I have a simple calendar that is loaded onto the page like this:
jQuery('#calendar .show_hide').load('plugins/calendar.html', function(){ // do something // });
That is not a problem
The calendar has 2 links that should scroll through the months - typical next prev links. So inside my load function I have this
jQuery('#calendar .show_hide').load('plugins/calendar.html', function(){
jQuery('a.month_change').on('click',function(){
jQuery.ajax({
type: "post",
data: jQuery(this).attr('href').replace('#',''),
url: 'plugins/calendar.html',
success:function(msg){
jQuery('#calendar .show_hide').html(msg);
}
});
});
});
where a.month_change is a class attached to the prev/next links. The Ajax post sends the data and returns the html. So far so good.
The first time you click a.month_change it works, but every time afterwards the page is not loaded. if I try .live('click;,function ...
nothing happens the first time, nor any other.
I always get confused on these things, which is the correct way to dynamically load the page and then have the ajax calls/links etc. always work. Note the dynamic load and the ajax receiving page are the same page - plugins/calendar.html and JQ version is jquery-1.9.0