I am trying to make a jsonp request in Angular 1.6 to get json data from a webservice. (URL censored here)
var url = ...;
var trustedUrl = $sce.trustAsResourceUrl(url);
$http.jsonp(trustedUrl, { jsonpCallbackParam: 'angularcallbacks_0' })
.then(function (data) {
console.log(data);
});
If I execute this, I get the following error: Uncaught SyntaxError: Unexpected token :
.
But in the "Sources"-Tab of the Chrome-Dev-Tool I can see the following response in valid json. enter image description here
In addition, I see following error in the console:
Possibly unhandled rejection: {"data":false,"status":404,"config":{"method":"JSONP","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"angularcallbacks_0","url":{},"headers":{"Accept":"application/json, text/plain, */*"}},"statusText":"error"}
What's the problem with my code? Thank you!