I had created a previous post but the post was closed before I could follow up.
(previous post: https://www.wix . com/velo/forum/coding-with-velo/how-to-grab-news-from-a-website )
I checked out the sources the Yisrael graciously provided, and they were very helpful but I am still having some trouble. On my website, I have a slider and inside the slider, I placed this code which is using the News API website.
(News API: https://newsapi . org/docs/endpoints/top-headlines)
getJSON ( https://newsapi . org/v2/top-headlines?sources=bbc-news&apiKey=<THIS IS WHERE I PUT MY API KEY>
)
. then ( json => {
console . log ( json )
$w ( ‘#text28’ ). text = json . articles ;
});
It feels like I am missing something obvious, but I’m not one hundred percent sure what. I know for a fact it’s not the slider function event because I have other working code in there. And I have the import { getJSON } from ‘wix-fetch’ ;
at the top of the page outside of a function.
This is my first time working with an API and getJSON, excuse my ignorance.