Google Calendar Parsing
Parsing xml with JQuery
by toubia95
HTML
<h1>Prochaines conférences</h1>
<div id="outputDiv"></div>
CSS
/*** JSON
* http://www.google.com/calendar/feeds/1fu618jp7q1eo5mvlm4g8n10us%40group.calendar.google.com/public/full?alt=json-in-script&orderby=starttime&max-results=4&singleevents=true&sortorder=ascending&futureevents=true&callback=?
*** CALENDAR API (base de la page)
* http://code.google.com/apis/gdata/docs/json.html
*/
JavaScript
$.getJSON(
"http://www.google.com/calendar/feeds/1fu618jp7q1eo5mvlm4g8n10us%40group.calendar.google.com/public/full?alt=json-in-script&orderby=starttime&max-results=4&singleevents=true&sortorder=ascending&futureevents=true&callback=?",
function(json) {
var html = '<ul>';
$.each(json.feed.entry,function(i,entry) {
var start = (entry['gd$when']) ? entry['gd$when'][0].startTime : "";
var formattedstart = formatGCalTime(start);
html += '<li>' + formattedstart + ' - ' + entry.title.$t + '</li>';
})
html += '</ul>';
$('#outputDiv').html(html);
}
);