jQuery Ajax Request
jQuery Ajax Request
Hi,
I wrote a search page for a website that I am working on located at
http://www.monaghanmedicalcentre.com/Search
If you type something into the search criteria then press search the results appear dynamically. If you then begin another search, enter "medical", you will see that the content flashes and returns, then after a pause the new content arrives.
Here is my code:
-
content.css({display:'none'});
var hash=Math.floor(Math.random()*1001);
$('#stuff').css({display:'none'});
$.ajax({
url:"/ww.plugins/dynamic-search/files/jsresults.php?dynamic_search=" + dynamic_search + "&dynamic_category=" + dynamic_category + "&hash=" + hash,
success: function(html){
content.html(html);
}
});
content.fadeIn('slow');
It seems that content.fadeIn('slow'); is being executed before the ajax results have returned. Is there anyway to postpone the fadeIn until the results have arrived?
Thanks for the help