PDA

View Full Version : IE not showing data


webrooster
10-22-2009, 02:15 PM
Hi all,

I'm new to Ajax, and thought things weren't going too badly - until I found out that my cool script doesn't work in IE.


function getTestimonial(pageLoad, divId, $id) {
if (window.id==0) {
var newUrl = pageLoad+"&count=yes";
$.get(newUrl,
function(data) {
window.idMax = parseInt(data);
}
);
}
newUrl = pageLoad+"&id="+window.id;
$(function(){
$.get(newUrl,
function(data) {
$("#"+divId).html(data)
// $("#"+divId).html(newUrl)
}
);
});
window.id++;
//alert(newUrl);
if (window.id > window.idMax) window.id = 0;
}


This is my script - which works perfectly in FF. When it runs in IE, the div is populated the first time it runs, but subsequent calls produce nothing.

The $id is the record number in essence and idMax is the max number of records. If I don't pass $id into the script - it seems that I can't access window.id to compare it to 0 (odd - but then I did say I was new to this)

The script is executed on a timer event every 10 seconds, and basically pulls a testimonial from a database. I know the code itself is working as the commented line shows the correct url which produces the correct response when I enter it into a browser. Of course the fact that it's working in FF proves that it's ok.

If anyone can shed some light on it for me, it would be greatly appreciated.


Cheers
John