2009-10-07 70 views
1

我正在處理以下頁面。jQuery AJAX parsererror

http://www.ranger.ryerson.ca/library/test/steveDev/testcarousel/test.html

它在火狐,Chrome和Opera,但在IE6,IE7和Safari(神拋棄的瀏覽器),他們都給我 「parsererror」

我的頁面使用jQuery的XML解析器和不好的瀏覽器都不喜歡它。陷入困境的代碼如下

$.ajax({ 
     type: "GET", 
     url: "http://www.ranger.ryerson.ca/library/test/steveDev/testcarousel/readXML.cfm", 


     dataType: "xml", 
     success: function(xml) { 
      $(xml).find('images').each(function(){ 
       $(this).find('pic').each(function() { 
        temp= '<a href="'+$(this).find('link').text()+'"><img src="'+$(this).find('thumbnail').text()+'" width="'+$(this).find('width').text()+'" style="border-style: none" height="75" title="'+$(this).find('alt').text()+'"alt="'+$(this).find('alt').text()+'" /></a>'; 
        carousel.add(count, temp); 
        count++; 
       }); 
       carousel.size(count); 
      }); 
     }, 
     error: function(XMLHttpRequest, textStatus, errorThrown){ 
      alert(textStatus); 
     } 

    }) 

我怎麼能解決我的問題

+0

祝你好運jCarousel;那個插件讓我瘋狂。 – 2009-10-07 15:19:34

+0

這是ajax調用去一個不同的域名?是這樣,也許這是一個jsoncallback問題?只是一個猜測。 – 2009-10-07 15:21:43

+0

我得到的傳送帶部分工作,我的問題是解析一些輸入它 – 2009-10-07 15:21:43

回答

2

有此節點上遇到了一個編碼錯誤:

<alt>Eugénie</alt> 
上線97

我注意到你指定encoding="utf-8"作爲編碼。你確定"é"真的用utf-8編碼嗎?

+0

從來沒有注意到。我如何逃避這個角色? – 2009-10-07 15:25:48

+0

使用正確的UTF-8序列:'é' – 2009-10-07 15:33:52

+0

或者...... HTML實體:'&eacute;',或以Unicode編碼字符的另一種方式:'U + 00E9'。請記住,HTML實體會使XML解析器不愉快,除非它已被定義(請參閱http://en.wikipedia.org/wiki/Character_encodings_in_HTML#XML_character_entity_references)。 – 2009-10-07 15:37:16