0
我試圖通過jquery .get()請求下載XML文件。不幸的是,返回的數據似乎是空的(0長度字符串),即使瀏覽器正確下載XML文件(請求返回通過螢火200 HTTP代碼)Jquery獲取xml文件
這裏是我的代碼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body>
Test sportevai<br/>
<script type="text/javascript" src="http://risultati.sportevai.it/sportevai_widget.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.get('http://servername.com/xml/10225.xml', function(data) {
alert(data.length);
$('.xcf').html(data);
});
});
</script>
<div id="xcf">div response</div>
</body>
</html>