I am trying to display information on the page that the ajax request is in progress, but I cannot figure out how to do it. Tried like this:
var html = $.ajax({ beforeSend: function(){ var id = $(this).attr('href'); var winH = $(window).height(); var winW = $(window).width(); $(id).css('top', winH/2-$(id).height()/2); $(id).css('left', winW/2-$(id).width()/2); $(id).fadeIn(10); }, type: "GET", url: "getcontent.php", data: "json=1&element="+el+"&dependence="+dep, async: false, success: function(){ $('#mask, .window').hide(); } }).responseText;
What am I doing wrong? But if you put async: true, then the json structure will not have time to fill in! And accordingly the ajax request is rendered useless!