Jquery 当发送数据类型为html的ajax post请求时,我的页面冻结

Jquery 当发送数据类型为html的ajax post请求时,我的页面冻结,jquery,ajax,Jquery,Ajax,我有一个ajax post脚本 $('#pagesfilter a').click(function(e){ var realname = $(this).attr("data-realname"); $.ajax({ url: "/ajaxpage", type: "POST", dataType: "html", data: { page: $(this).attr('data-page') }, //c

我有一个ajax post脚本

$('#pagesfilter a').click(function(e){
    var realname = $(this).attr("data-realname");
     $.ajax({
       url: "/ajaxpage",
       type: "POST",
       dataType: "html",
       data: { page: $(this).attr('data-page') },
       //cache: false,
       async:true,
       beforeSend: function() { //show loading animation 
            $('.whiteblur').show();
            $('.windows8').show();
         },
         complete: function(){ //hide loading animation
            $('.windows8').hide();
            $('.whiteblur').hide();
         },
       success: function(data){ //display the requested page
          $("#main_content_wrapper").html(data);
          $('.breadcrumb .active a').attr("href", "#");
          $('.breadcrumb .active a').text(realname);
       }
    });

    $(this).parent().slideUp();
    e.preventDefault();
});
正如您在顶部看到的,这是一个html页面类型的ajax,我在其中发送一个名为“page”的post键及其内容,例如“home”,然后服务器将返回home.html,my home.html的内容是html标记(div、a、p、article、h1、h2、h3、h4、section)和脚本声明(例如

这些脚本对于请求的页面(例如home.html)是必需的,它只运行到请求的页面(例如home.html),如果先声明,则会在当前文档中创建冲突,因此我必须仅在加载请求的页面时声明它。在收到响应html数据(例如主页html)后,它将被放入id为“main_content_wrapper”的div中

问题:除了ajax post请求工作时,其他一切都可以工作,它会冻结,直到ajax post请求完成,这看起来很糟糕,因为加载动画也会冻结。如何使加载动画在ajax post请求完成或页面本身完成之前不冻结


非常感谢您提供的任何帮助、线索、想法、建议和建议。

请勿使用
async:true
!确保页面可以正确显示,而无需删除内容。为什么?我相信我请求了一个大数据(html),甚至没有异步:true。页面本身仍然冻结,因为
async:true
只有一个目标:冻结页面。这比评估更邪恶。我明白了。谢谢你提供的信息