开发者

jquery ajaxStart function and ajaxComplete function wont work in ie7 and ie8

开发者 https://www.devze.com 2023-02-14 22:14 出处:网络
Hi stackoverflow jquery experts, I\'ve got a problem on my ajaxStart function and ajaxComplete function, it wont work on ie7 and ie8, but works perfectly in ie9. below is my code. Ho开发者_如何学Pyth

Hi stackoverflow jquery experts,

I've got a problem on my ajaxStart function and ajaxComplete function, it wont work on ie7 and ie8, but works perfectly in ie9. below is my code. Ho开发者_如何学Pythonpe you can helf me on this. Thanks in advance.

$('#findAcademy').bind('keyup', function() { 
    $(".loader").ajaxStart(function(){
        $(this).show();
    }).ajaxComplete(function(){
        $(this).hide();
    });

    $.ajax({
      url: "findBook.php?action=populateacademy&query="+this.value+"",
      cache: false,
      dataType: "json",
      success: function(data) {
        $.each(data.items, function(i,item){
            $("#viewAcademy").append('<div class="nameWrapper"><input name="checkMeT" type="checkbox" value="'+item.bookId+'|::|'+item.bookName+'"/><span title="'+item.bookName+'" class="checkBoxSpan">'+item.bookName+'</span></div>');
        });
    }});
});


Try this ,

$(document).ajaxStart(function() {
  $('.loader').show();
}).ajaxStop(function() {
  $('.loader').hide();
});

try this way

$('.loader').show();
 $.ajax({
      url: "findBook.php?action=populateacademy&query="+this.value+"",
      cache: false,
      dataType: "json",
      success: function(data) {
            $('.loader').hide();
        $.each(data.items, function(i,item){
            $("#viewAcademy").append('<div class="nameWrapper"><input name="checkMeT" type="checkbox" value="'+item.bookId+'|::|'+item.bookName+'"/><span title="'+item.bookName+'" class="checkBoxSpan">'+item.bookName+'</span></div>');
        });
    }});
0

精彩评论

暂无评论...
验证码 换一张
取 消