Reputation: 9
I am trying to build an event calendar. In this I have written a gateDate function that returns the date of respective clicked field from the calendar I have created. I want to pass this date to index action please help me.
function getDate() {
$('.cal_daybox').on('click', function () {
var timestamp = parseInt($(this).attr('id'));
var day = new Date(timestamp);
alert("You clicked " + day.toDateString());
});
}
Thank You.
Upvotes: 0
Views: 61
Reputation: 1527
Put that date in hiddenfield and make a function which redirect user to index action.
eg.
function goToIndex() {
var _date = $('#hiddenfield').val();
document.href = '/Home/Index/?date=' + _date;
}
Upvotes: 1