can someone PLEASE give me some vanilla javascript code that will make a get request to https://api.wasteof.money/posts/64fa845c62c9b104f65962d4/ and display it as an <p> element on screen?

comments (single view)

currently not on my computer, but essentially you have to use fetch to get the content of https://api.wasteof.money/posts/64fa845c62c9b104f65962d4/, and then set the .innerHTML of an element to the post.content

here’s an example of it: https://git.tnix.dev/Tnix/random/src/branch/main/wasteof/example-64fa922ea5efdaee65509cce.html

btw the API has CORS, so requests to the API from another website will fail, you’d have to use something like a browser extension to bypass CORS policies, but I don’t recommend that for security reasons.

adding on to what tnix’s response was, you could replace the url in the JS with a corsproxy version of it with no need for an extension.

oh yes, I forgot those existed

oh, thanks. If you have time later, can you provide a code snippet for making the fetch request? I can do the inter html part

View all comments