-1

jQuery AJAX supports DELETE method, right?

Please enumerate arguments pro and contra for using POST vs DELETE jQuery AJAX requests to the backend to delete an object.

Is it true that with DELETE requests we may have trouble with proxy servers?

porton
  • 5,214
  • 11
  • 47
  • 95
  • 2
    Why wouldn't jQuery support DELETE method? To jQuery, it's just a piece of text in HTTP protocol, it can support any random word you stick in there. The problem is that the web server receiving the message SHOULD support that method. Since web servers can and are proxies to other servers, it might happen that due to configuration some of them deny the request and label it as something they don't support or recognize. That's why you TEST your app. You can enumerate pro and con yourself I believe, as this isn't "give me facts when I tell you to" kind of website, is it now? – N.B. Apr 02 '17 at 09:02

1 Answers1

2

According to Wikipedia (https://en.wikipedia.org/wiki/Representational_state_transfer) the argument is twofold: on the one side 'Unlike SOAP-based Web services, there is no "official" standard for RESTful Web APIs.' while on the other side PUT and DELETE are 'Standard HTTP Methods'

The strongest argument for DELETE is that it is the most widely used accepted standard for REST, and that is an advantage when you have to "justify" jour choices (an accepted standard is right, unless there are specific reasons to say the opposite)

The strongest argument against DELETE (and for using POST) is that it is far easier to test via simple forms and if you use odd frameworks (I am just supposing, i do not know about such things)

Besides, standard HTTP methods should not be blocked by proxies (using HTTP is exactly the point for web services for not being blocked) so I would in the end go for standard and use DELETE as shown in the wikipedia article.

Ettore Galli
  • 677
  • 6
  • 24