dimanche 29 juillet 2018

Getting "Uncaught SyntaxError: Unexpected token :" while accessing JSON from external URL

I am trying to access JSON data from an external URL.

I am using JSONP and here is my code :

$.ajax({
url: 'https://myurl.com',
dataType: 'JSONP',
jsonpCallback: 'callback',
type: 'GET',
success: function (data) {
    console.log(data);
}});

The status code is 200, even I can see the JSON from that URL but I am getting the error:

Uncaught SyntaxError: Unexpected token :

and unable to work with that JSON data

Can anyone help me to figure this out?




Aucun commentaire:

Enregistrer un commentaire