I want to make an AJAX request "in the background" of my JavasSript function, but my script waits for the AJAX request to complete before it continues to execute my code.
$('div').hide();
$.get('/controller/action', { id: 'abc123' },
function(data){
//request completed
//now update the div with the new data
$('div').html(data);
}
);
$('div').slideDown('slow');
//by now hopefully the div has been updated
//and the user hasn't waited too long
The problem is that the slideDown
animation waits to execute until the request has returned a response. How can I get the the animation to execute at the same time as the ajax request?