I am having trouble to add new event to fullCalendar using Jquery. I am using Eclipse to develop web and not familiar with Ajax at all and aperantly, it does not work with my eclipse.
Everything is written inside a button.click function in jquery.
var subject = $("#txtEventName").val(); //the title of the event
var dateStart = $("#txtDate").val(); //the day the event takes place
var dateEnd = $("#txtDateEnd").val(); //the day the event finishes
var allDay = $("#alldayCheckbox").val(); //true: event all day, False:event from time to time
var events=new Array();
event = new Object();
event.title = subject;
event.start = dateStart; // its a date string
event.end = dateEnd; // its a date string.
event.color = "blue";
event.allDay = false;
events.push(event);
$('#calendar').fullCalendar('addEventSource',events);
No bugs were detected but the event is not created. P.S: I would like to stay with array feed if no other way in jQuery.
Try this:
var newEvent = new Object();
newEvent.title = "some text";
newEvent.start = new Date();
newEvent.allDay = false;
$('#calendar').fullCalendar( 'renderEvent', newEvent );
Note that when you assign value to start it needs to be in one of the supported formats.
You may specify a string in IETF format (ex: Wed, 18 Oct 2009 13:00:00 EST
), a string in ISO8601 format (ex: 2009-11-05T13:15:30Z
) or a UNIX timestamp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With