简体   繁体   English

AJAX请求中的POST与DELETE

[英]POST vs DELETE in AJAX requests

jQuery AJAX supports DELETE method, right? jQuery AJAX支持DELETE方法,对吗?

Please enumerate arguments pro and contra for using POST vs DELETE jQuery AJAX requests to the backend to delete an object. 请列举参数pro和相反,以说明对后端使用POST vs DELETE jQuery AJAX请求以删除对象。

Is it true that with DELETE requests we may have trouble with proxy servers? 确实,对于DELETE请求,我们可能在代理服务器上遇到了麻烦?

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.' 根据Wikipedia( https://en.wikipedia.org/wiki/Representational_state_transfer )的说法,它具有双重含义:一方面,“与基于SOAP的Web服务不同,RESTful Web API没有“正式”标准。” while on the other side PUT and DELETE are 'Standard HTTP Methods' 另一方面,PUT和DELETE是“标准HTTP方法”

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) 对于删除最强的说法是,它是REST最广泛使用的通行标准,这是一个优势时,你必须“证明”怨妇选择(可接受的标准是正确的,除非有特殊原因的说法对面)

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) 最强的论据DELETE(以及使用 POST)是它要容易得多测试通过简单的形式,如果你使用奇框架(我只是假设,我不知道这样的事情)

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. 此外,标准的HTTP方法不应被代理阻止(使用HTTP正是Web服务不会被阻止的关键点),因此最终我将寻求标准并使用Wikipedia文章中所示的DELETE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM