I cannot send any date object through jQuery Ajax, why?
var nid = '99';
var date = new Date("October 13, 2014 11:13:00");
$.ajax({
data: {
nid: nid,
evs: date,
},
type: 'POST',
url: '/ajax/save_scheduler',
dataType: "json",
error:function(xhr,err){
return false;
},
success: function(res) {
// console.log(res);
}
});
I am familiar with jQuery ajax. Usually I have any problem to send variables through it. But I am stocked there..
In server side, I can then catch $_POST['nid'], but cannot get $_POST['evs'].
$nid = $_POST['nid'];
$evs = $_POST['evs'];
I get this message:
Notice: Undefined index: evs in ajax_save_scheduler()
Can someone explain why?
/***** Edit ******/
In firebug, I cannot see the date in post tab of the query:
If I change the date line like this:
var evs = "October 13, 2014 11:13:00";
It works as usual.