我正在使用jQuery Full日历。单击时将放置一个按钮,整个日历将发送帖子请求。在按钮上单击日历需要从文本框中获取值并从站点重新获取事件。
该错误当按钮被点击的文本框中空值被发送和被发送默认选择项的值而不是由用户输入新的价值观是。
如何解决这个问题。以下是代码
$('#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'
}
]
});
$("input[name=Doctor]").val()
在您的页面加载时,将在此处进行一次评估。这就是为什么您之后输入的内容都不会发送的原因。
您可能应该使用以下函数加载事件:http : //fullcalendar.io/docs/event_data/events_function/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句