I am trying to post data to a script on my own server through the jQuery $.ajax function in the following way:
var data = {};
var date = new Date();
data.selectedDate = selectedDate;
$.ajax({
type: "POST",
url: "http://www.url.com/somescript.php",
dataType: 'json',
data: this.data,
async: false,
})
If I remove the data parameter the script gets called. Can any one explain what’s going wrong?
Some one suggested this earlier but his post seems to have been deleted. JSON ecoding the data prior to posting fixed the problem. I’m not sure why I suddenly need to do this as I have posted to this server before with out json encoding my data, maybe it’s cause I’m working on a public wifi.
Thanks to every one for the help.