Help to resolve a JS error when connecting to an external API.

Options
andyjhoey
andyjhoey Member
edited December 2022 in Webflow

Hi Xano community,

I was hoping i could get some expert advice regarding an issue I'm having with a custom weather api in webflow.

I was using Prakash's https://www.youtube.com/watch?v=HMsrFzoZYr0 tutorial on how to link up a API endpoint to Webflow. However when publishing the website the data will not show due to this JS error: Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') at request.onload when hitting F12 in the chrome console.

It seems the issue is with the link between the JS variable and the API data is undefined somehow.

I'm terrible at JS and I'm really stuck on this issue, The good news is in Xano, the API is showing the data, and has been setup using a variable to filter unecessary data. The API key is working with no errors and if the webflow read only link you will see the JS i have put into the before body section of the website home page. I have also attached the JS used as an attachment.

My end goal is to have the data showing on the website when the page loads just like Prakash's does in the tutorial. I'm really stuck on this so any help would be fantastic!

API end point snippet for Xano if this helps:

https://www.xano.com/snippet/iBjRXW51

Screenshots attached

Webflow staging url: https://wswr.webflow.io/

Webflow read only link: https://preview.webflow.com/preview/wswr?utm_medium=preview_link&utm_source=designer&utm_content=wswr&preview=8c85235853e2efb4f99ec332fb9063a2&workflow=preview


Answers