I'm trying to get my data to show up as an object in the console. But it fails to do so and console logs "error". Only other thing that shows up in the console is a Cross-Origin-Read-Blocking warning. No errors though. How can I get my data to log on the console? Thanks
$.ajax({
url: "valid url that returns JSON",
type: "GET",
dataType: "jsonp",
jsonp: "callback",
headers: { "Accept": "application/javascript;odata=verbose" },
success: function (response) {
console.log(response);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
}
});
Before the code above, I had "json" instead of "jsonp" and "application/json" instead of "application/javascript" as shown in the code below, but these returned a 401 Unauthorized error as well as a "CORS no access-control-allow-origin header" error. When I added jsonp, these errors went away and a CORB warning was left (shown in the code above). But my json data still nowhere to be found. Console logging ajaxOptions results in a "parsererror". Console logging thrownError results in
Error: jQuery112409451109716420985_1542218619324 was not called
at Function.error (jquery.min.js:2) at h.jsonp.b.dataTypes.(anonymous function).b.converters.script json (http://kendo.cdn.telerik.com/2018.3.1017/js/jquery.min.js:4:28685) at Xb (jquery.min.js:4) at y (jquery.min.js:4) at HTMLScriptElement.b.onload.b.onreadystatechange (jquery.min.js:4)"
$.ajax({
url: "valid url that returns JSON",
type: "GET",
dataType: "json",
jsonp: "callback",
headers: { "Accept": "application/json;odata=verbose" },
success: function (response) {
console.log(response);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
}
});