0
我有一個靜態的HTML頁面weather.html
XML jQuery的分析似乎並沒有爲我工作
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://www.google.com/ig/api?weather=Delhi",
dataType: "xml",
success: parseXml
});
});
function parseXml(xml) {
$(xml).find("weather").each(function() {
alert($(this).attr("temp_c"));
});
}
</script>
</head>
<body>
</body>
</html>
警報似乎並沒有得到顯示在頁面的時候,我檢閱槽螢火蟲,我發現這一點,
XML Parsing Error: no element found Location: moz-nullprincipal:{08ba4230-2feb-48d3-969e-b53579b07b52} Line Number 1, Column 1:
^
也起到parseXml
似乎並沒有得到所謂...
完成它的任何其他方式... – 2010-07-09 07:42:48
是的,無論是使用服務器端腳本,將充當代理或JSONP(只與'GET'請求)。 – 2010-07-09 07:48:00