Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery块ui仅在函数的ajaxStart上显示_Jquery_Ajax_Loading_Blockui - Fatal编程技术网

Jquery块ui仅在函数的ajaxStart上显示

Jquery块ui仅在函数的ajaxStart上显示,jquery,ajax,loading,blockui,Jquery,Ajax,Loading,Blockui,我目前正在使用Blockui阻止页面,并在执行ajax功能时显示加载的gif。请看这里: $(document).ready(function() { //shows loading screen whilst posting via ajax $().ajaxStart(function() { $.blockUI({ message: '<h1><img src="../images/layout/busy.gif" /&

我目前正在使用Blockui阻止页面,并在执行ajax功能时显示加载的gif。请看这里:

$(document).ready(function() { 
            //shows loading screen whilst posting via ajax
    $().ajaxStart(function() { 
        $.blockUI({ message: '<h1><img src="../images/layout/busy.gif" /> Just a moment...</h1>' });  });           
    $().ajaxStop($.unblockUI);                     

//Load table from table.php
//Timestamp resolves IE caching issue
var tsTimeStamp= new Date().getTime();
$.get('table.php',
      {action: "get", time: tsTimeStamp},
      function(data){
        $('#customertable').html(data).slideDown('slow');
      });
return true;                           

});
$(文档).ready(函数(){
//通过ajax发布时显示加载屏幕
$().ajaxStart(函数(){
$.blockUI({message:'稍等…});});
$().ajaxStop($.unbui);
//从table.php加载表
//时间戳解决IE缓存问题
var tsTimeStamp=new Date().getTime();
$.get('table.php',
{操作:“获取”,时间:tsTimeStamp},
功能(数据){
$('#customertable').html(数据).slideDown('slow');
});
返回true;
});

我的问题是,每次执行ajax函数时,它都会阻塞页面。如何使其仅在执行某些功能时出现

您必须从通用ajaxStart和ajaxStop事件中取消阻止/取消阻止,并根据具体情况进行阻止/取消阻止:

$.blockUI({ message: '<h1><img src="../images/layout/busy.gif" /> Just a moment...</h1>' });
$.get('table.php',
      {action: "get", time: tsTimeStamp},
      function(data){
        $.unblockUI();
        $('#customertable').html(data).slideDown('slow');
      });
$.blockUI({消息:'稍等…');
$.get('table.php',
{操作:“获取”,时间:tsTimeStamp},
功能(数据){
$.unbui();
$('#customertable').html(数据).slideDown('slow');
});