M
M
matveyvarg2017-03-28 14:19:28
Computer networks
matveyvarg, 2017-03-28 14:19:28

What is the best way to delete an object?

Let's say we have a link (id - variable) What is the best way to implement the transfer of id to the server, taking into account the fact that we need to delete the object with this id ? 1) Use jQuery and ajax for the "DELETE" method. 2) Leave the "GET" method and intercept the id on the server as a named route ? If there is a third option, I'd love to hear it.
<a href="<id>">Delete</a>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2017-03-28
@Rou1997

AJAX or not, jQuery or not, see for yourself, ideally AJAX is ubiquitous (SPA), in practice, as it turns out, HTTP methods do not need any DELETE, do everything on GET or POST, many libraries that implement HTTP for the client have convenient means for sending GET and POST, but no DELETE, etc., and there are also CMS for servers, etc., where no one will write $_REQUEST['id'], but either $_GET or $_POST.

D
Defman21, 2017-03-28
@Defman21

HTTP DELETE if the backend is RESTful.
GET with a parameter otherwise.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question