cant really seem to figure out what i am doing wrong. Totally puzzled. I am simply trying to print the title field from this xml
我似乎无法弄清楚我做错了什么。完全不解。我只是试图从这个xml打印标题字段
https://www.google.com/calendar/feeds/communications%40doitt.nyc.gov/public/full?max-results=3
Here is my html and jquery
这是我的html和jquery
<div id="outputTitle"></div>
<script>
$(function(){
$.get('https://www.google.com/calendar/feeds/communications%40doitt.nyc.gov/public/full?max-results=3', function(data){
$(data).find("title").each(function(){
$("#outputTitle").append($(this)+ "<br />");
});
});
});
</script>
Here is the fiddle
这是小提琴
http://jsfiddle.net/sghoush1/teJS3/1/
1 个解决方案
#1
0
Use getJSON and add the needed parameter to your URL.
使用getJSON并将所需参数添加到您的URL。
Then manipulate the data as you like ( I just print the whole feed as JSON in the example ). --> http://jsfiddle.net/blackjim/teJS3/3/
然后根据需要操作数据(我只是在示例中将整个Feed打印为JSON)。 - > http://jsfiddle.net/blackjim/teJS3/3/
more here --> Sample Using Google Calendar API JSON Output
更多信息 - >使用Google Calendar API JSON输出的示例
// handler function
var handleData = function (data,txt,jqXHR) {
var feed = data.feed; // your feed is here
$("#outputTitle").text(JSON.stringify(feed));
};
// use getJSON and add alt=json-in-script as parameters to your url
$.getJSON('http://www.google.com/calendar/feeds/communications%40doitt.nyc.gov/public/full?alt=json-in-script&callback=?', handleData );
#1
0
Use getJSON and add the needed parameter to your URL.
使用getJSON并将所需参数添加到您的URL。
Then manipulate the data as you like ( I just print the whole feed as JSON in the example ). --> http://jsfiddle.net/blackjim/teJS3/3/
然后根据需要操作数据(我只是在示例中将整个Feed打印为JSON)。 - > http://jsfiddle.net/blackjim/teJS3/3/
more here --> Sample Using Google Calendar API JSON Output
更多信息 - >使用Google Calendar API JSON输出的示例
// handler function
var handleData = function (data,txt,jqXHR) {
var feed = data.feed; // your feed is here
$("#outputTitle").text(JSON.stringify(feed));
};
// use getJSON and add alt=json-in-script as parameters to your url
$.getJSON('http://www.google.com/calendar/feeds/communications%40doitt.nyc.gov/public/full?alt=json-in-script&callback=?', handleData );