I searched for similar questions but no luck.
If I add an element to DOM with ajax, I can't control it. I know, live method will works for events but I just want to show/fade it.
Is there a way to control those ?
$("#menu > div > ul > li > a").click(function(){
var page = $(this).attr("href").replace('#','');
$.ajax({
url: page + '.php',
beforeSend: function() { $("#page").fadeOut(); $('#loader').fadeIn("slow"); },
complete: function() { $('#loader').fadeOut(); },
success: function(data){
$('body').append(data);
$(data).show();
}
});
});
The data contains following and Its a string;
<div id="container-01"> <div class="left"> left </div> <div class="right"> right </div> </div>
Thank you.