开发者

Fullcalendar trouble displaying events in IE using 'events (as a function)' using xml

开发者 https://www.devze.com 2023-01-25 01:22 出处:网络
I know this has been asked before but I haven\'t found a decent solution. I\'m using events (as a function) and .ajax. Of course everything displays correctly except in IE. I\'m using FullCalendar v1.

I know this has been asked before but I haven't found a decent solution. I'm using events (as a function) and .ajax. Of course everything displays correctly except in IE. I'm using FullCalendar v1.4.8 and jquery-1.4.2.min.js. Here's my code:

$('#calendar').fullCalendar({
    theme: true,
    events: function(start, end, callback) {
        var mystart = (start.getMonth() + 1)+"/"+(start.getDate())+"/"+(start.getFullYear())
        var myend = (end.getMonth() + 1)+"/"+(end.getDate())+"/"+(end.getFullYear())
        $.ajax({
            cache: false,
            type: "POST",
            url: 'calendar_data.asp',
            data: "start="+mystart+"&end="+myend+"&_rand="+Math.floor(Math.random()*100),
            error: function(xhr, type, exception) { alert("Error: " + exception); },
            success: function(doc) {
                var events = [];
                $(doc).find('event').each(function() {
                events.push({
                title: $(this).attr('title'),
                url: $(this).attr('url'),
                start: $(this).attr('start') // will be parsed
            });         
        });         
        callback(events);
        }
        });
    },
    loading: function(bool) {
        if (bool) $('#loading').show();
        else $('#loading').hide();
    },
    weekMode: 'variable',
    aspectRatio: 2,
    allDayDefault: false,
    eventClick: function(event) {
            if (event.url) {
                window.open(event.url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");
                return false;
            }
        },
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,basicWeek,basicDay'
    },

});

Any my xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <events><event id="396" title="Heartsaver Adult CPR and AED Course" start="11/12/2010 12:30 PM" />
    <event id="395" title="Heartsaver Adult CPR and AED Course" start="11/12/2010 8:00 AM" />
    <event id="416" title="Basketball Tournament" start="11/13/2010 8:00 AM" />
    <event id="414" title="Basketball Tournament" start="11/13/2010 9:00 AM" />
    <event id="417" title="Basketball Tournament" start="11/14/2010 8:00 AM" />
    <event id="415" title="Basketball Tournament" start="11/14/2010 9:00 AM" />
    <event id="245" title="Pediatric CPR Course" start="11/16/2010 6:30 PM" />
    <event id="397" title="Heartsaver Adult CPR and AED Course" start="11/16/2010 8:00 AM" />
    <event id="240" title="Healthcare Provider CP开发者_开发技巧R Course" start="11/18/2010 6:00 PM" />
    <event id="413" title="Hockey tournament" start="11/20/2010 7:00 AM" />
    <event id="420" title="Basketball Tournament" start="11/20/2010 8:00 AM" />
    <event id="384" title="Basketball Tournament" start="11/21/2010 9:00 AM" />
    <event id="421" title="Basketball Tournament" start="11/21/2010 9:00 AM" />
    <event id="398" title="Adult First Aid Course" start="11/23/2010 8:00 AM" />
    </events>

What do I need to change to get the events to display in IE?


Silly question but I have to...

If you replace all that AJAX stuff with a plain and simple javascript array (taken, for example, from the FullCalendar demos) does it then work in IE? If so, the problem is related to AJAX and independent of FullCalendar.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号