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 jQuery 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; });
Aren’t you supposed to append the form to body before you can submit it? Not sure how it works in Chrome without that, but try doing something like this-