Trying to access an external API.
Using jQuery 1.9.1.
$.ajax({
cache: true, // remove the _ query parameter from the url
dataType: 'script', // used to be 'jsonp', however changed to 'script' in order to remove the _ query parameter being added to the url
jsonp: false, // remove the callback query parameter, this causes the url to fail
type: 'GET',
url: 'http://api.external-domain.com/format/json/',
success: function(data){
alert('success');
$.each(data.parent, function(i, item){
var vname = item.Name;
$('<li />').html(vname).appendTo('#list');
});
},
error: function(){
alert('failure');
}
});
The success alert is displayed, the item names are not written to the list, however the browsers developer tool states
Firefox: SyntaxError: invalid label
Chrome: Uncaught SyntraxError: Unexpected token
The error message identifies the json file as the cause, however if I copy the same json file and place it on the local server (while amending the dataType to json) it works.
Please help.