My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 957: Adding events: events is not defined
1 person starred this issue and may be notified of changes. Back to list
Status:  Done
Owner:  ----
Closed:  May 2011


Sign in to add a comment
 
Reported by afran...@portchester.bournemouth.sch.uk, May 17, 2011
Can you explain why I'm getting the error "events is not defined" in Firebug

<script type="text/javascript">

           $(document).ready(function() {
               $('#calendar').fullCalendar({
                   defaultView: 'agendaWeek',
                   allDayDefault: false,
                   weekends: false,
                   titleFormat: " d MMMM{ '—'[ MMM] d MMMM yyyy}",
                   columnFormat: 'ddd',
                   allDayText: "",
                   minTime: '7:00',
                   maxTime: '24:00',
                   events: function(start, end, callback) {
                       $.ajax({
                           url: "/Xml/StaffCalendar.xml",
                           dataType: "xml",
                           data: {
                               start: Math.round(start.getTime() / 1000),
                               end: Math.round(end.getTime() / 1000)
                           },
                           success: function(doc) {
                               var events = [];
                               $(doc).find('event').each(function() {
                                   events.push({
                                       title: $(this).find('title'),
                                       start: $(this).find('sDate'),
                                       end: $(this).find('eDate')
                                  });
                               });
                             }
                          });
                        callback(events); 
		    }                                  
                  });                                 
               });                 
         </script> 

Thanks in advance for any help
May 30, 2011
Project Member #1 adamrs...@gmail.com
the `callback(events)` lines needs to be within the success function
Status: Done
Sign in to add a comment

Powered by Google Project Hosting