How to specify DELETE method in a link or form?

Maurício C Antunes picture Maurício C Antunes · Aug 3, 2011 · Viewed 80.8k times · Source

Rfc2616 lists many methods besides GET and POST, like, say, DELETE, PUT etc. Method field in html forms, though, seems to be allowed to specify only GET or POST.

Is it possible to create a link or form in a html page that uses a request method that is not GET or POST?

Answer

AlmightyWhy picture AlmightyWhy · Feb 9, 2016

Was trying to figure this out for a rails app that was using Angular on the front end; these seems to work for that environment:

<a data-confirm="Are you sure?" data-method="delete" href="/link-to-resource" rel="nofollow">Delete</a>

Edit: Just to give everyone a heads up, I think you still need to have jQuery for this to work. I removed jQuery and it stopped working; I put it back and it started working.