Bongs
Bongs

Reputation: 5592

delete confirmation in ruby-on-rails using jQuery UI dialog to make normal http request

I am showing delete confirmation box using jQuery UI dialog. But on delete I don't want to make any ajax call when user click on delete, as after deleting I want to redirect to home page. The delete should make normal http request with method delete. How can I achieve it?

$("#delDialog").dialog({
    autoOpen: false,
    width: 300,
    modal: true,
    resizable: false,
    buttons: {
            "Delete": function() {
                if (gohome) // redirect to home
                    {
                        //here I want to make normal call to delete post without using .post/.get/.ajax
                        $(this).dialog("close");
                    }
            },
            "Cancel": function() {
                $(this).dialog("close");
            }
        }
    });

Upvotes: 2

Views: 942

Answers (1)

IanN
IanN

Reputation: 289

Im pretty sure ryan from railcasts.com shows you how to exactly what your after in one or two of his screencasts.

Have a squiz, because I ws looking at using html delete requests without an ajax call and saw his way on his screencasts.

Upvotes: 1

Related Questions