1

現在、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;                           

});

私の問題は、これが ajax 関数が実行されるたびにページをブロックすることです。特定の機能が実行されているときにのみ表示されるようにするにはどうすればよいですか

4

1 に答える 1

2

一般的な 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');
      });
于 2010-02-25T21:10:10.097 に答える