Here is my script to make a request cross-domain request. Since the data type is JSONP I would expect to receive a JSONP response, however the other server will only return a JSON file (which I can view using chrome developer console) but I don't know how to extract that JSON file.
For the code, it will run to "error" and "commplete" sections but not success, the error will be reported as the "callback function <....name of callback function....> was not called. I do not know how to work about it, please help!
$.ajax({
type: "GET",
crossDomain : true,
url:"http://192.168.100.2:3000/api/dashboards/db/practice1/",
dataType: "jsonp",
Authorization: "Bearer eyJrIjoieWsyRW5URG4xZ1ZjVHhCd0Q0UmNjZmx1ODZoMmRiVEwiLCJuIjoidmlld2VyIiwiaWQiOjF9",
success: function(data){
alert("success");
console.log(parseJSON(data));
},
error: function(data, httpReq, status, exception) {
alert(httpReq + " " + status + " " + exception);
//console.log(data.success);
},
complete : function(data,httpReq,status,exception){
//apiStatus(data);
//console.log(data.success);
}
});