I want to log the data that is stored in an URL as JSON with an AJAX call.
$.ajax({
"url": "https://api.logair.unige.ch/v1/service/device/latest?device_id=LAEM_02&latest=1",
"method": "GET",
"crossDomain": true,
"dataType": 'jsonp',
"headers": {
'Access-Control-Allow-Origin': '*'
},
success: function(response) {
console.log(response)
},
error: function(error) {
console.log(error);
}
});
But I'm getting:
Object { readyState: 4, getResponseHeader: getResponseHeader(e), getAllResponseHeaders: getAllResponseHeaders(), setRequestHeader: setRequestHeader(e, t), overrideMimeType: overrideMimeType(e), statusCode: statusCode(e), abort: abort(e), state: state(), always: always(), catch: catch(e), … }
instead of the JSON that you can find in the URL.