A solution without JS:
Make a landing page with PHP that will handle the deletion and redirect you back - that way, you'll have no worries about the UI and you can even get away with a GET request from standard anchor tags. The user flow will look more natural than doing AJAX + refresh on success.
You can even use the existing page (let's call it page.php
), for example:
- click an anchor that will take you to
page.php?action=delete&token=123&ids=1-2-3-4-5
- the page will recognize the action parameter, validate the token and delete items with the submitted IDs
- after it's done, it will redirect you back to
page.php
(so the URL looks nice again and you're safe with users clicking the refresh button)