我正在使用jFeed解析原子提要並嘗試顯示標題。我寫過成功和錯誤函數,但它沒有涉及成功或錯誤函數。無法使用jQuery解析原子提要
以下是我的代碼。請讓我知道下面的代碼出了什麼問題。
<!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=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="javascript/jquery.jfeed.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//read the atom feed
$.getFeed({
type:"GET",
url:"http://www.google.co.in/trends/hottrends/atom/hourly",
success:function(feed)
{
alert(feed.title);
},
error:function(error)
{
alert(error);
}
});
});
</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
我看,你的例子和jfeeds一樣。但返回數據通常是一個列表而不是單個項目,對嗎?爲什麼你只是不要在「alert(feed.title)」處設置一個斷點,將鼠標懸停在feed上並查看對象內部的真實內容? – Luke