my code is
events: function(callback) {
$.ajax({
url: 'schoolmanagement/jsonevents',
dataType: "json" ,
success: function(doc) {
var events = [];
$(doc).find('el').each(function() {
events.push({
title: $(this).attr('title'),
start: new Date($(this).attr('start')),
end: new Date($(this).attr('end')),
allDay: true,
className: 'bgm-cyan',// will be parsed
});
});
callback(events);
}
});
},
and my json response is
{"el": [
{"end":"2016-09-25T00:00:00","start":"2016-09-25T00:00:00","title":"Weekly Holiday"},
{"end":"2016-10-02T00:00:00","start":"2016-10-02T00:00:00","title":"Gandhi Jayanti"},
{"end":"2016-10-09T00:00:00","start":"2016-10-09T00:00:00","title":"Weekly Holiday"},
{"end":"2016-09-15T00:00:00","start":"2016-09-15T00:00:00","title":"School Foundation day"}
]}
You are returning json not html/xml use the following:
success: function(doc) {
var events = [];
$.each( doc.el,function(i,v) {
events.push({
title: v.title,
start: v.start,
end: v.end,
allDay: true,
className: 'bgm-cyan', // will be parsed
});
});
callback(events);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.