getJSON request failed! | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
getJSON request failed!
No permission to create posts
October 17, 2020
4:09 am
Avatar
loeffma
New Member
Members
Forum Posts: 3
Member Since:
October 17, 2020
sp_UserOfflineSmall Offline

Hi Folks.

For a few days now I've been getting the following error message on my own page when I want to call up data from Thingspeak and display it in Google Gauge or Google Chart: "getJSON request failed!"
What can be the reason?

Regards

October 19, 2020
9:30 am
Avatar
Vinod

MathWorks
Members
Forum Posts: 341
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

Did you try my suggestion here

October 20, 2020
5:13 am
Avatar
loeffma
New Member
Members
Forum Posts: 3
Member Since:
October 17, 2020
sp_UserOfflineSmall Offline

Hi Vinod,

many thanks for your response. But something else seems to be wrong. Here is the excerpt from the code where the request to ThingSpeak is made:

////////////////////////////////// Get the Data ////////////////////////////////////////
// setup for request to ThingSpeak ...
var urlOption = 'https://api.thingspeak.com/channels/' + dataStreamPublicKey + '/feed.json?api_key=XXXXXXXXXXXXX';
var dataOption = {
results: numPointsToPlot,
start: startDate,
end: endDate
};

// make the request to ThingSpeak ... ()JSONP to enable cross-domain ajax calls)
var jsonData = $.ajax({
url: urlOption,
...

Do you see another error of the request of thingspeak here?

Regards

October 20, 2020
8:25 am
Avatar
loeffma
New Member
Members
Forum Posts: 3
Member Since:
October 17, 2020
sp_UserOfflineSmall Offline

I found the mistake. The data type must be "json" and no longer "jsonp"! That’s it.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
29 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

daner, Tito Silveira, HomeImprove123, Bryan, kenwood1701, dosh2684

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457