I've spent a lot of time on this task and did hours of research but I still don't have a solution to this.
I get an 401 error
But if I add this at the end of the url: ?jsonpcallback=?
I get this in the console: Uncaught SyntaxError: Unexpected token :
Can someone guide me on this please and tell me what I'm doing wrong. Thank you in advance!
Here's my code:
$.ajax({
type: "GET",
url: "XXX/jsonpcallback=?",
dataType: 'jsonp',
crossDomain:true,
success: function (data){
console.log(data);
},
error: function (err) {
console.log(err)
}
});
Try this.
$.getJSON('XXX/jsonpcallback=?xxx', function(data) {
console.log(data);
});