开发者

jQuery works in IE & FF but not in Chrome

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开发者_如何学Python() {, 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜