How to use request method DELETE?

I see there is a method of request called isDelete and isPut. How do I use these? In some other frameworks I need to add a hidden input parameter with the method and post it (something to do with browsers only supporting GET and POST or something like that. Anyway how does Phalcon allow me to use these HTTP methods (or simulate them where I can use isDelete or isPut)?



84.0k

If the HTTP client send the request via PUT/DELETE you can use them in Phalcon

Yeh but how do I do this from a form? If I set the forms action to DELETE, it just sends it using GET (with GET parameters). If I POST it using a hidden _METHOD input field with a value "DELETE" (as other frameworks do it), it just remains as POST. I don't know how to do this in Phalcon. Or should I just update and delete on POST from a form?

HTML form tag only allowes GET/POST as values for method.

PUT/DELETE requests require a separate client to send them.

Maybe you can use javascript (jQuery) to do this

$.ajax({
    url: '/your/file',
    type: 'DELETE',
    success: function(result) {
        // Do something with the result
    }
});