How can I link to a page and make the browser call it with the DELETE method, as Rails does?
I tried <a href="DELETE /post?id=3">DELETE ME</a>
but doesn`t work.
I use Node.js, so I can use it to handle DELETE method.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can't. Links will only ever trigger a GET request.
You can choose between a GET and a POST in a form.
Other HTTP request types can be made using JavaScript and XMLHttpRequest, but not reliably cross-browser.
回答2:
You can use a javascript plugin like RestfulizerJs for converting your links to pseudo forms.