Saturday, 17 August 2013

jQuery not working in Internet Explorer 9 (but works in Firefox, Chrome and Opera)

jQuery not working in Internet Explorer 9 (but works in Firefox, Chrome
and Opera)

I wrote a jQuery script that works in Chrome, Firefox and Opera but not in
Internet Explorer 9.
Basically, an image loaded in the background with ajax should fadein and
be replaced dynamically as others images are uploaded in the same folder.
In Internet Explorer the script just doesn't work and the image is not
loaded.
I tried debugging with firebug and the IE developer toolbar but I am a
little bit inexperienced: can you help me out? Thank you!
This is the code
$(window).load(function() {
var data;
$('.nascosto').hide();
$('.ciccio').hide();
$.ajax({
type: "GET",
url: "phpdelete.php",
success: function(data) {
$("<img/>").attr("src", data).load(function() {
$(this).remove();
});
}
});
setInterval(prova, 1000);
function prova() {
$.ajax({
type: "GET",
url: "phpdelete.php",
success: function(data2) {
if (data2 != data) {
$('.ciccio').fadeOut(2000, function() {
$("<img/>").attr("src", data2).load(function() {
$(this).remove();
$('.ciccio').css('background-image', 'url(' +
data2 + ')').delay(500).fadeIn(2000);
data = data2;
});
});
}
}
});
}
});

No comments:

Post a Comment