I donβt know about Rails specifically, but I often create web pages that send DELETE (and PUT) requests using Javascript. I just use XmlHttpRequest objects to send the request.
For example, if you use jQuery:
there is a link that looks like this:
<a class="delete" href="/path/to/my/resource">delete</a>
And run this javascript:
$(function(){ $('a.delete').click(function(){ $.ajax( { url: this.getAttribute('href'), type: 'DELETE', async: false, complete: function(response, status) { if (status == 'success') alert('success!') else alert('Error: the service responded with: ' + response.status + '\n' + response.responseText) } } ) return false }) })
I wrote this example mainly from memory, but I'm sure it will work.
source share