问题
I'm using fullcalendar and what I want is that the date clicked be passed to a dialog box modal form(asp.net mvc PartialView). This is my code right now:
$calendar.fullCalendar({
events: "/Home/CalendarData",
dayClick: function (date) {
$calendar.fullCalendar("renderEvent", { title: "on process", start: date}, true);
$("#editDialog").html('')
.load("/Home/About", function () {
$("#editDialog").data("value", date).dialog("open");
});
}
});
As you see i already tried passing a value to my dialog using data() function. Is there a way for my PartialView to access that data?
回答1:
You should be able to pass a json payload using the second parameter of the $.load
for example
$calendar.fullCalendar({
events: "/Home/CalendarData",
dayClick: function (date) {
$calendar.fullCalendar("renderEvent", { title: "on process", start: date}, true);
var payLoad = {
‘selectedDate’ : date
};
$("#editDialog").html('')
.load("/Home/About", payLoad, function () {
$("#editDialog").data("value", date).dialog("open");
});
}
});
In the above example, we are creating a json object by the name of payLoad and passing it in via $.load method. Now you can define a variable by the name selectedDate on your controller action and capture the value
来源:https://stackoverflow.com/questions/15053390/passing-fullcalendar-date-to-my-dialog-box-modal-form