All,
Say I have the following bit of code:
select: function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
alert(start);
jQuery.post("save_calendar_event.php", {
title: title,
start: start,
end: end,
allDay: allDay
}, function(data){
alert(data);
});
}
calendar.fullCalendar('unselect');
}
Then I have a PHP page to accept the post values:
$title = $_POST['title'];
$start_time = $_POST['start'];
echo "The start time is: ".$start_time;
If I echo back the $title it works fine but if I do the $start_time it says the value isn’t there. When the alert is shown for the start on the jQuery side it has the data that I’m looking to pass. Why won’t it pass this variable to my PHP page?
EDIT: If I do the alert my alert shows: Sun Jan 29 2012 12:00:00 GMT-0600 (Central Standard Time)
Thanks!
You have to force convert your
startandendjs date time object tostring/timestampfirst (before send to $.post).@Kai Qing I think jQuery already encoded parameters for you.