samedi 14 mars 2015

Full Calendar Event Sources Data passing null values in parameter

I am using jQuery Full calendar. A Button is placed when clicked the full calendar will send post request. On button click the calendar needs to get the values from textbox and refetch events from the site.


The error is when the button is clicked the null values from text box is sent and default select item value is being sent rather then new values that are entered by the user.


How to solve this. Following is the code



$('#search').click(function() {

$('#calendar').fullCalendar('refetchEvents');

});

$('#calendar').fullCalendar({
defaultView: 'agendaDay',
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay'
},
cache: false,
eventSources: [
{
url: "http://" + window.location.host + "/Appointment/Appointments/",
type: 'POST',
data: {
doctor: $("input[name=Doctor]").val(), **//NULL VALUE IS SENT**
room: $('select[name=Room]').val() **//DEFAULT SELECT LIST ITEM VALUE SENT**
},
error: function() {
alert('there was an error while fetching events!');
},
success: function (dataQ) {

for (var i = 0; i < dataQ.length; i++) {
dataQ[i].start = moment(dataQ[i].start);
dataQ[i].end = moment(dataQ[i].end);
}
},
color: 'grey',
textColor: 'white'
}
]
});

Aucun commentaire:

Enregistrer un commentaire