AJAX GET request not console logging response, no errors except a CORB warning
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);
);
jquery ajax kendo-ui request jsonp
|
show 17 more comments
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);
);
jquery ajax kendo-ui request jsonp
You've gotdataType: "jsonp"
and"Accept": "application/json
. If you want jsonp, you needapplication/javascript
, if you want json then you need to change the dataType todataType: "json"
– Tiny Giant
Nov 14 '18 at 17:29
If that is the only problem then this is a duplicate of What is the correct JSON content type?
– Tiny Giant
Nov 14 '18 at 17:34
I changed application/json to application/javascript and still no luck. The reason I changed json to jsonp in the first place was to get rid of a 401 unauthorized error, which worked and now the error is gone. But my json is still not being returned
– Daniel Pickert
Nov 14 '18 at 17:39
Well you were getting the CORS error because no Access-Control-Allow-Origin was set on the target. JSONP doesn't use CORS, but the response has to be in JSONP, or it won't work. I'm guessing that the response is really JSON and you need to deal with the origin problem.
– Tiny Giant
Nov 14 '18 at 18:24
That's what I was thinking too. I turn CORS on in chrome and the 'Access-Control-Allow-Origin' error disappears. Now all I'm left with is a 401 Unauthorized error
– Daniel Pickert
Nov 14 '18 at 18:28
|
show 17 more comments
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);
);
jquery ajax kendo-ui request jsonp
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);
);
jquery ajax kendo-ui request jsonp
jquery ajax kendo-ui request jsonp
edited Dec 22 '18 at 15:13
marc_s
578k12911161262
578k12911161262
asked Nov 14 '18 at 17:25
Daniel PickertDaniel Pickert
135
135
You've gotdataType: "jsonp"
and"Accept": "application/json
. If you want jsonp, you needapplication/javascript
, if you want json then you need to change the dataType todataType: "json"
– Tiny Giant
Nov 14 '18 at 17:29
If that is the only problem then this is a duplicate of What is the correct JSON content type?
– Tiny Giant
Nov 14 '18 at 17:34
I changed application/json to application/javascript and still no luck. The reason I changed json to jsonp in the first place was to get rid of a 401 unauthorized error, which worked and now the error is gone. But my json is still not being returned
– Daniel Pickert
Nov 14 '18 at 17:39
Well you were getting the CORS error because no Access-Control-Allow-Origin was set on the target. JSONP doesn't use CORS, but the response has to be in JSONP, or it won't work. I'm guessing that the response is really JSON and you need to deal with the origin problem.
– Tiny Giant
Nov 14 '18 at 18:24
That's what I was thinking too. I turn CORS on in chrome and the 'Access-Control-Allow-Origin' error disappears. Now all I'm left with is a 401 Unauthorized error
– Daniel Pickert
Nov 14 '18 at 18:28
|
show 17 more comments
You've gotdataType: "jsonp"
and"Accept": "application/json
. If you want jsonp, you needapplication/javascript
, if you want json then you need to change the dataType todataType: "json"
– Tiny Giant
Nov 14 '18 at 17:29
If that is the only problem then this is a duplicate of What is the correct JSON content type?
– Tiny Giant
Nov 14 '18 at 17:34
I changed application/json to application/javascript and still no luck. The reason I changed json to jsonp in the first place was to get rid of a 401 unauthorized error, which worked and now the error is gone. But my json is still not being returned
– Daniel Pickert
Nov 14 '18 at 17:39
Well you were getting the CORS error because no Access-Control-Allow-Origin was set on the target. JSONP doesn't use CORS, but the response has to be in JSONP, or it won't work. I'm guessing that the response is really JSON and you need to deal with the origin problem.
– Tiny Giant
Nov 14 '18 at 18:24
That's what I was thinking too. I turn CORS on in chrome and the 'Access-Control-Allow-Origin' error disappears. Now all I'm left with is a 401 Unauthorized error
– Daniel Pickert
Nov 14 '18 at 18:28
You've got
dataType: "jsonp"
and "Accept": "application/json
. If you want jsonp, you need application/javascript
, if you want json then you need to change the dataType to dataType: "json"
– Tiny Giant
Nov 14 '18 at 17:29
You've got
dataType: "jsonp"
and "Accept": "application/json
. If you want jsonp, you need application/javascript
, if you want json then you need to change the dataType to dataType: "json"
– Tiny Giant
Nov 14 '18 at 17:29
If that is the only problem then this is a duplicate of What is the correct JSON content type?
– Tiny Giant
Nov 14 '18 at 17:34
If that is the only problem then this is a duplicate of What is the correct JSON content type?
– Tiny Giant
Nov 14 '18 at 17:34
I changed application/json to application/javascript and still no luck. The reason I changed json to jsonp in the first place was to get rid of a 401 unauthorized error, which worked and now the error is gone. But my json is still not being returned
– Daniel Pickert
Nov 14 '18 at 17:39
I changed application/json to application/javascript and still no luck. The reason I changed json to jsonp in the first place was to get rid of a 401 unauthorized error, which worked and now the error is gone. But my json is still not being returned
– Daniel Pickert
Nov 14 '18 at 17:39
Well you were getting the CORS error because no Access-Control-Allow-Origin was set on the target. JSONP doesn't use CORS, but the response has to be in JSONP, or it won't work. I'm guessing that the response is really JSON and you need to deal with the origin problem.
– Tiny Giant
Nov 14 '18 at 18:24
Well you were getting the CORS error because no Access-Control-Allow-Origin was set on the target. JSONP doesn't use CORS, but the response has to be in JSONP, or it won't work. I'm guessing that the response is really JSON and you need to deal with the origin problem.
– Tiny Giant
Nov 14 '18 at 18:24
That's what I was thinking too. I turn CORS on in chrome and the 'Access-Control-Allow-Origin' error disappears. Now all I'm left with is a 401 Unauthorized error
– Daniel Pickert
Nov 14 '18 at 18:28
That's what I was thinking too. I turn CORS on in chrome and the 'Access-Control-Allow-Origin' error disappears. Now all I'm left with is a 401 Unauthorized error
– Daniel Pickert
Nov 14 '18 at 18:28
|
show 17 more comments
1 Answer
1
active
oldest
votes
This works for me
$.ajax(
type: 'GET',
url: 'my_url',
data: key: 'value' ,
dataType: 'json',
success: function (data)
console.log(data);
,
error: function (xhr, ajaxOptions, thrownError)
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
);
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305691%2fajax-get-request-not-console-logging-response-no-errors-except-a-corb-warning%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This works for me
$.ajax(
type: 'GET',
url: 'my_url',
data: key: 'value' ,
dataType: 'json',
success: function (data)
console.log(data);
,
error: function (xhr, ajaxOptions, thrownError)
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
);
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
add a comment |
This works for me
$.ajax(
type: 'GET',
url: 'my_url',
data: key: 'value' ,
dataType: 'json',
success: function (data)
console.log(data);
,
error: function (xhr, ajaxOptions, thrownError)
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
);
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
add a comment |
This works for me
$.ajax(
type: 'GET',
url: 'my_url',
data: key: 'value' ,
dataType: 'json',
success: function (data)
console.log(data);
,
error: function (xhr, ajaxOptions, thrownError)
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
);
This works for me
$.ajax(
type: 'GET',
url: 'my_url',
data: key: 'value' ,
dataType: 'json',
success: function (data)
console.log(data);
,
error: function (xhr, ajaxOptions, thrownError)
console.log(xhr);
console.log(ajaxOptions);
console.log(thrownError);
);
edited Nov 14 '18 at 21:06
Poul Bak
5,48831233
5,48831233
answered Nov 14 '18 at 17:54
MelihMelih
186
186
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
add a comment |
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
When I do 'json' it returns a 401 unauthorized error and a 'CORS no access-control-origin-header' error. when i use jsonp, no errors show up but my data is still not returning. when i console log ajaxOptions like you have me do, it returns parsererror...which i hear is common with jsonp
– Daniel Pickert
Nov 14 '18 at 18:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305691%2fajax-get-request-not-console-logging-response-no-errors-except-a-corb-warning%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You've got
dataType: "jsonp"
and"Accept": "application/json
. If you want jsonp, you needapplication/javascript
, if you want json then you need to change the dataType todataType: "json"
– Tiny Giant
Nov 14 '18 at 17:29
If that is the only problem then this is a duplicate of What is the correct JSON content type?
– Tiny Giant
Nov 14 '18 at 17:34
I changed application/json to application/javascript and still no luck. The reason I changed json to jsonp in the first place was to get rid of a 401 unauthorized error, which worked and now the error is gone. But my json is still not being returned
– Daniel Pickert
Nov 14 '18 at 17:39
Well you were getting the CORS error because no Access-Control-Allow-Origin was set on the target. JSONP doesn't use CORS, but the response has to be in JSONP, or it won't work. I'm guessing that the response is really JSON and you need to deal with the origin problem.
– Tiny Giant
Nov 14 '18 at 18:24
That's what I was thinking too. I turn CORS on in chrome and the 'Access-Control-Allow-Origin' error disappears. Now all I'm left with is a 401 Unauthorized error
– Daniel Pickert
Nov 14 '18 at 18:28