Hi, I’m working on a little side project practicing some vanilla js, ajax, and api’s. It’s very simple and uses the cat API to grab random cat pictures and vote on them. I’m using native XHR but hopefully it’s not too onerous to look at.
Since I can’t share my api key, the voting functionality is missing here, but you’ll have to take my word for it that it works when the correct headers are used
Problem is I can’t seem to get the DELETE request to work. When I try to delete all the votes I get successful responses back from the server but none of them actually delete. I genuinely don’t know if this is a problem with the API or if there is something wrong with my code. I’ve also used the postman-like utility on the docs page for the cat api here:
I use my API key and everything, response comes back successful but when I do a get request on the votes they are still all there.
Would love to know if anyone sees any glaring problems with my code (I already know lack of error handling is definitely a problem). But I really just wanna know why delete requests aren’t working.