views:

572

answers:

1

I am loading feed-items into a ul using this jQuery .ajax() call, which I basically lifted from http://www.makemineatriple.com/2007/10/bbcnewsticker/

var timestamp = true; //set whether timestamp is displayed in
          $.ajax({
            type: "GET",
            url: "sample-feed.xml",
            dataType: "xml",
            success: function(xml) {                  
              $(xml).find('item').each(function(){
            var title = $(this).find('title').text();
            var link = $(this).find('link').text();
            if(title.length >=57){              
                title = title.substring(0,54) + "..."; 
            }
            var addItem = '<li class="tickerTitle"><a href="'+link+'">'+title+'</a>';
            if (Boolean(timestamp)== true){
                var time = new Date(Date.parse($(this).find('pubDate').text()));
                addItem +='<span class="timestamp">' + makestamp(time) +'</span></li>';
            }

            $('ul#news').append(addItem);
          });

It works in Chrome 4 and Firefox 3.6, but I load it up in IE8 and somehow the ajax call fails. I have tried to use IE8's Developer tools to see where exactly it fails, but I haven't been successful yet.

So two questions

  1. Is there anything blatantly wrong with my ajax call here that could be preventing me from seeing it in IE where it works in FF/Chrome?
  2. Are there any special considerations I have to make for the Internet Explorer family of browsers with regards to this particular jQuery method?

I've done some googling on this but nothing obvious is coming up.

One other note: I am currently using jQuery 1.3.2 due to some legacy scripts on the same site. I did try loading 1.4.2 and it had the same results on IE8

+1  A: 

Are you doing your tests in local file system? Then you most probably get "Access denied", since each file is counted as a different origin and "same-origin-policy" is applied by IE.

If it is on the server already, I suggest you watch HTTP traffic between your computer and the server, using Fiddler Tool (http://fiddlertool.com) to see if the ajax call is actually issued.

naivists
I am indeed doing my tests in a local file system. I was not aware that IE regards different files as from a different origin.Where would I see the "access denied" error? I don't appear to get any errors in the js console in the Developer Tools. I haven't added an error condition to the .ajax() call, however. I'll have to do that at my next opportunity.
RyanV
I've sometimes seen it appear as a generic JavaScript error, signalized by Internet Explorer only in lefthand side of the status bar.
naivists
It must have been the Access Denied thing. I uploaded it to a live server and it works in IE8 now.
RyanV