views:

30

answers:

0

Objective is to read from ticker.xml, parse, and set the html of headline1, headline2, headline3, etc. divs to the values of ticker.xml.

This works great in IE 8 and FF but not in Chrome. Any thoughts?

<script type="text/javascript">
$(document).ready(function()
{
  $.ajax({
    url: 'ticker.xml',
    type: 'GET',
    dataType: 'xml',
    timeout: 1000,
  error: function(xhr, status, error) {
 var err = eval("(" + xhr.responseText + ")");
   alert(xhr);
 },
    success: parseXml
 });
 function parseXml(xml)
 {
 var i = 0;
   //find every Tutorial and print the author
  $(xml).find("ticker").each(function()
 {
 i++;
 $("#headline"+i).html($(this).find("headline").text());
  });
 }
});
</script>

Also, it is working intermittently in Chrome. Sometimes it will change the div, sometimes it won't. I tried removing the first line of code, $(document).ready(function() {, and putting the script at the end of the html right before the tag and I'm still getting the same inconsistent result. Please help.