I have posted question here and answer is correct but I’m was not perfectly clear. On the init page load everything is ok, but I need to call with date parameter as argument.
So this is fine
$('#myDate').click(function () {
var date = getDate();
})
but I should send this date to
$('#dataTable').dataTable({
...
Update
Ok, I'm simplifying this,
$('#dataTable').dataTable({
...
on page load takes myDate value and sends this value to the controller. This is fine. Problem is when after page load user pick some other date, I want again to send this data value to the $('#dataTable').dataTable({..
Hope this helps, thanks
function getDate() {
var date = $('input[name="myDate"]').val();
return date;
};
$('#myDate').click(function () {
var date = getDate();
return date;
});
$('#dataTable').dataTable({
"bServerSide": true,
"sAjaxSource": "/Home/Ajax",
"fnServerParams": function (aoData) {
var date = getDate();
aoData.push({ "name": "myDate", "value": date });
},
Maybe something like this?