How to fetch the data from a php through ajax in the jquery fullcalendar when click prev r next function



I want to get the function for the specific event:



$('#my-prev-button').click(function() {
$('#calendar').fullCalendar('prev');
});


and i have a code for the full calendar event i want to do it specifically for the prev or next event and i want to get the start and end date from that function please help me friends and currently by the coding i given bellow its returning the current date


Jquery part:



$('#calendar').fullCalendar({
// theme:true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate:"2014-11-01",
events: function(start, end, timezone, callback) {
$.ajax({
url: 'myxmlfeed.php',
type:'post',
dataType: 'html',
data: {
// our hypothetical feed requires UNIX timestamps
start: start.format(),
end: end.format()
},
success: function(doc) {
var events = [];
$(doc).find('event').each(function() {
events.push({
title: $(this).attr('title'),
start: $(this).attr('start'), // will be parsed
end: $(this).attr('end')
});
});


callback(events);
}
});
}
});


XML part:



<xml>
<event id="1" title="first entry" url="http://www.google.com" start="2014-12-22" />
<?php
$start = $_GET['start'];
?>

<event id="2" title="first entry" url="http://www.google.com" start="<?php $start; ?>" />
<event id="3" title="fir entry" url="http://www.google.com" end="<?php $_GET['end']; ?>" />
</xml>

No comments:

Post a Comment