简体   繁体   中英

FullCalendar.js external events data from classic asp page

I am struggling to get external events data from asp into fullcalendar.js I'm using the demo files from fullcalendar.io and cannot work out how to get my data to display at all

eg

$(document).ready(function() {
        $('#calendar').fullCalendar({       
            url: '../../data/calendar.asp',
});
});

and the asp page displays data presented in the following way

{ "events": [ {"title":"Test Title","start":"2016-04-28T16:30:00Z","end":"2016-04-28T17:30:00Z"}, {"title":"Another Test Title,"start":"2016-05-05T16:30:00Z","end":"2016-05-05T17:30:00Z"}, {"title":"Final Test Title","start":"2016-05-05T17:30:00Z","end":"2016-05-05T17:30:00Z"} ] }

Any suggestions would be really appreciated

You could use getJson to get the json from the asp page and then use the events element from it:

$(function(){
$.getJSON( "../../data/calendar.asp", function( data ) {
    $('#calendar').fullCalendar({
     events: data.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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM