Right now I’m running a flask app that is hosted on AWS. When I call my AWS endpoint by simply going to the html endpont, which looks like
blahblah.us-east-1.awsapprunner.com/someParameter/
the flask app will return a json list in the browser like below
[
" Some sentence",
" another sentence ",
" and yet another sentence "
]
So, with that being said, I ultimately want to call this endpoint when a button is clicked, then return the data to some JS variable so I can ultimately do something with the data.
Psuedocode below
export function button2_click(event) {
above_sentences = func_that_calls_endpoint_and_returns_above_json_list()
console.log(above_sentences) # this should print the above json list, just so I can see that I actually have the list in a variable
}
EDIT 1:
I tried using
getJSON(“https://blahblah.us-east-1.awsapprunner.com/ass/”)
.then(json => console.log(json))
.catch(err => console.log(err));
But I get the error
TypeError: Failed to fetch