jquery ajaxStart function and ajaxComplete function wont work in ie7 and ie8
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>');
});
}});
精彩评论