jQuery .submit() woes with IE8

Posted by Jitesh on Stack Overflow See other posts from Stack Overflow or by Jitesh
Published on 2010-05-17T05:27:56Z Indexed on 2010/05/17 5:30 UTC
Read the original article Hit count: 235

Filed under:
|

I am trying to submit a delete link click via a http post to my asp.net mvc controller. While my code below works for chrome it does not work in IE8. Any pointer will be very useful.

Setup:- Browser: IE8 jQuery: 1.4.1 MVC: 2.0

The delete link is:-

<a title="Delete contact" href="/Contacts/Delete/<%= Model.Contact.Id %>" class="delete" rel="Are you sure you want to delete <%= Html.Encode(Model.Contact.Name) %>?">Delete</a>

and the jqeury handler for the click of delete is

$("a.delete").click(function() {
if (confirm($(this).attr("rel"))) {
    var form = "<form method='POST' action='" + $(this).attr("href") + '" style='display:none;'></form>";
        $(form).submit();
    }
    return false; });

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about jQuery