JQuery $ .ajaxSend()无法在Firefox(33.0)中运行

时间:2014-10-24 11:02:25

标签: jquery ajax firefox

我有:

..............
$(document)
   .ajaxSend(function () {
   alert('test'); //for testing in FF
      switch (flag_mask) {
       case 0:
              mask_find_way.hide();
              mask_create_way.hide();
              mask_load.show();
              break;
       case 1:
              mask_load.hide();
              mask_create_way.hide();
              mask_find_way.show();
              break;
       case 2:
              mask_find_way.hide();
              mask_load.hide();
              mask_create_way.show();
              break;
 }
 }).ajaxStop(function () {
   mask_load.hide();
   mask_find_way.hide();
   mask_create_way.hide();
 });
..............

我尝试使用jquery 1.8.3,1.11.1,2.1.1和$ .ajaxSend()只能在FF中工作(警报不能正常工作)?

1 个答案:

答案 0 :(得分:0)

工作很好:

  function preload_mask() {
     $(document)
        .ajaxSend(function () {
          switch (flag_mask) {
                case 0:
                       mask_find_way.hide();
                       mask_create_way.hide();
                       mask_load.show();
                       break;
                case 1:
                       mask_load.hide();
                       mask_create_way.hide();
                       mask_find_way.show();
                       break;
                case 2:
                       mask_find_way.hide();
                       mask_load.hide();
                       mask_create_way.show();
                       break;
          }
        }).ajaxStop(function () {
          mask_load.hide();
          mask_find_way.hide();
          mask_create_way.hide();
        });
  }
  $(window).load(function() {
      preload_mask();
  });