I am using a jQuery calendar to display events, which is designed to pull data from the server. On innit the calendar fires off a AJAX request to get an array of events objects
The variations of date.toString
did not work for me until I added json headers to the post. The resulting code is as follows:
var pstData = {
begDate: date1.toUTCString(),
endDate : date2.toUTCString()
};
$.ajax({
url:'url',
type:'POST',
data: JSON.stringify( pstData ),
contentType: "application/json; charset=utf-8",
dataType: "json",
})