One thing to be aware of, which can be a source of unexpected behavior, is that $.animate is asynchronous. That is, the animation will not be executed when $('#right_content').html(content); . The final animate argument allows animate to specify the callback function that will be executed when the animation is executed.
t
$.ajax({ url:url, beforeSend: function(){ $('.slide_loader').show(); }, success:function(content){ $('#right_content').animate({ 'margin-left' : '200px' }, 500, function() { $('#right_content').html(content); $('.slide_loader').hide(); }); return false; } });
source share