I have updated my code to what is below and im now getting a different error: jquery.min.js:2 GET https://<domain>.kintone.com/k/v1/records.json?app=6&callback=jQuery34107591808757762462_1583879308454&_=1583879308455 net::ERR_ABORTED 520
varsettings = {
‘cache’:false,
‘dataType’:“jsonp”,
“async”:true,
“crossDomain”:true,
“url”:“https://<domain>.kintone.com/k/v1/records.json?app=6”,
“method”:“GET”,
“headers”: {
“accept”:“application/json”,
“Access-Control-Allow-Origin”:"*",
“X-Cybozu-API-Token”:“token”
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Hello Tyler,
I have checked the code and seems like its just a typo where is says:
‘dataType’:“jsonp”,
it should be
‘dataType’:“json”
Hopefully that helps.
We tried this. However it came up with the following alarm. It’s a CORS alarm. This is what a application engineer told us to do to avoid said alarm.
Access to XMLHttpRequest at ‘https://<domain>.kintone.com/k/v1/records.json?app=6’ from origin ‘null’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Hello Tyler,
The error that you see is most likely caused by the cross-domain restriction. You should execute the API from the server side to avoid the error.
*Sorry couldn’t find any helpful site for reference.