How to do REST using PUT and DELETE

It talks about the type option of the jQuery.ajax () method, which

Type of request ("POST" or "GET"), by default - "GET". Note. Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.

So...

  • Does this mean that PUT and DELETE will not work if the browser does not support it, or simply that PUT and DELETE cannot be executed by the user in the browser?

  • If I cannot or should not use them, what do people usually do? Send method as GET or POST parameter? Or?

+4
source share
1 answer

PUT and DELETE will not work if the browser does not support it. A common workaround is a POST request with an additional field containing the method (for example, _method = "PUT" in the POST values). Some web frameworks (Spring MVC, Ruby on Rails) will do such a thing for you.

+3
source

Source: https://habr.com/ru/post/1312783/


All Articles