I write this message to ask your help regarding a project that deals with the display of information on a web page which come from an API. More precisely, it’s about showing the destination and the waiting times of trains from Lyon train station. I’ve wrote down on a code already and I don’t know what’s wrong with it. If someone could help me, that’d be wonderful.
I’m seeing an error in the console, I’ll do my best to explain them:
Uncaught TypeError: json.features is undefined
The script is looking for the features key in the JSON response from the API, but can’t find it as it doesn’t exist. I believe you will want to replace that with result (possibly even result.schedules)
Firefox gives you a very nice and visual way to view JSON:
I tried to replace “features” by “result” and “result.schedules” in the JS and it didn’t work. Do I have to replace some stuff in the HTML file as well ? Maybe you could make the code work and then show me where I was wrong ? Because I have to finish this evening and this is still not working…