开发者

HTML form PUT method [duplicate]

开发者 https://www.devze.com 2023-03-31 19:53 出处:网络
This question already has answers here: 开发者_JS百科Are the PUT, DELETE, HEAD, etc methods available in most web browsers?
This question already has answers here: 开发者_JS百科 Are the PUT, DELETE, HEAD, etc methods available in most web browsers? (7 answers) Closed 8 years ago.

Because the server side only accepts PUT method, I used method='PUT' in the HTML form. But the browser didn't use method PUT as expected, it's GET. When I set method='POST' it's POST.

I don't know why method='PUT' doesn't work. I have tested on Chrome and Firefox.


Browsers only support POST and GET, if you need PUT, you have to send the form via post/get and then do the proper PUT request on server-side.

EDIT although, most implementations of XMLHttpRequest support PUT and DELETE.


PUT is not recognized and is assimilated to GET.

Most frameworks use a hidden input to obtain PUT or DELETE:

<input type="hidden" name="_method" value="PUT">
0

精彩评论

暂无评论...
验证码 换一张
取 消