I have a client server application. The user should be able to delete an item. So in the url he will just send the ID of the item.
So simply a javascript call like this would be fine.
window.location = '/api/games?ItemId'=id ; But of course this would be a GET request and not a delete . So what should I do now.
Just declare it a GET Request on server side or what I do not want to do make it an ajax call.
if (isset($_GET['id'])) { $id = $_GET['id']; $remove->removeImage($id); }and if php code in that file is not possible or wanted, you might have to use ajax to send it to a php handler file<form>which uses the existing HTTP verb POST. There's no general way in a browser to send a DELETE verb without using javascript.<form>(to a POST handler) as a work-around. Then a few years ago someone realised that we should be using the correct verb for the correct action instead of piggy-backing on existing verbs, but there's still no built-in way to send PUT and DELETE requests.