I'm pretty new to web development, so bear with me. I've also simplified the code to try to get the best answer.
<a href="/item/1">Item</a>
<img src="x.png" alt="Delete">
Basically, if someone clicks "Item" they get taken to /item/1. If they click the img x.png, it should ask the server to delete /item/1.
Obviously nothing is going to happen if I click x.png with the code as it is, but that's the big question:
I can make my web server recognize the DELETE method for /item/:id, but how do I submit DELETE from a browser? If I can't that makes POST or GET as the only options.
Wrapping the img around a href=... would be easy, but that only does a GET and would break RESTfulness, so it looks like I need to use POST. How can I do this cleanly?
Second question:
I'm assuming I would also have to refresh the page after submitting the delete to get fresh data. Is there a way to avoid this?
HTML, JavaScript, JQuery answers are all welcome.