[求解]ajax方式读取xml时,firefox没动静!
holyzfy
2008-11-14
按照触发顺序,最先是ajaxStart,最后是ajaxComplete。 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>testRss</title> <script src="jquery-1.2.6.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $("#loader").ajaxStart(function(){ $(this).show(); }); $("#loader").ajaxComplete(function(){ $(this).remove(); }); $.ajax({ type: "GET", url: "http://news.163.com/special/00011K6L/rss_newstop.xml", dataType: "xml", success: function(xml){ alert($(xml).text()); } }); }); </script> </head> <body> <div id="loader" style="display:none;"> <img src="loading.gif" title="正在加载..."/> </div> </body> </html>
|
|
holyzfy
2008-11-14
google了几个例子,我发现:不论是$.ajax里url,还是$.get里的url,必须是相对地址。
附上jquery api里的说明 ![]() 这儿有个例子:http://www.think2loud.com/2008/09/reading-xml-with-jquery/,xml文件在demo里,大家可以试下。 |
|
holyzfy
2008-11-15
忽略了最重要的一点:xml是不能跨域的
![]() |
|
蒋中正
2009-06-17
引用 引用 [i][/i][u][/u][b][/b]
|