I am trying to create a record and it works on the swagger dashboard, but not from my local machine nor jsfiddle. The ajax call returns successfully, but no data is added to the database. There are no javascript errors. Here is my javascript:
var ip = "1.2.3.4";
var url = "https://dsp-sitename.cloud.dreamfactory.com:443/rest/URMobileStats/AdViews?app_name=URMobileStats";
/*var record = {
"AdID": "1",
"DateTime": String(new Date($.now())),
"ClickedBool": "0",
"OS": navigator.platform,
"IP": ip,
"Position": ""
};*/
var record = {"AdID":5,"DateTime":"Fri Aug 22 2014 18:04:47 GMT-0600 (Mountain Daylight Time)","ClickedBool":"0","OS":"Win32","IP":"1.2.3.4.5","Position":""};
$.ajax(
{
type: "POST",
url: url,
data: record,
dataType: "jsonp",
success: function () { alert('success'); },
error: function (XHR, textStatus, errorThrown) {
alert("error: " + errorThrown);
}
});