Is there any reason not to use HTTP PUT and DELETE in a web application?

后端 未结 7 774
深忆病人
深忆病人 2021-01-31 03:04

Looking around, I can\'t name a single web application (not web service) that uses anything besides GET and POST requests. Is there a specific reason for this? Do some browsers

7条回答
  •  一向
    一向 (楼主)
    2021-01-31 03:27

    This depends on your browser and Ajax library. For example jQuery supports all HTTP methods even though the browser may not. See for example the jQuery "ajax" documentation on the "type" attribute.

    The Restlet Java framework lets you tunnel PUT and DELETE requests through HTML POST operations. To do this, you just add method=put or method=delete to your URI's query string, eg:

    http://www.example.com/user=xyz?method=delete ...
    

    This is the same as Ruby on Rails' approach (as described by @ars above).

提交回复
热议问题