Hello, I have an Ajax form that lets me dynamically remove rows from a table using the OnComplete AjaxOption. That works great.
The problem is that even if I hit "Cancel" on the confirm dialog, it still executes the OnComplete javascript. So the form doesn't post, but it looks like it did to the user (the row is removed from the table).
Any ideas? Source code below:
OnComplete JS:
function fadeDel(id) {
$("#product" + id).fadeOut(500);
}
Form Code:
<% using (Ajax.BeginForm("DeleteProduct", "Commerce", new { id = product.Id },
new AjaxOptions
{
OnSuccess = "fadeDel(" + product.Id + ")",
Confirm = "Are you sure you want to delete" + product.Title
}, new { id = "frm" + product.Id }))
{ %>
<%= Html.SubmitImage("Delete", Url.Content("~/content/images/12-em-cross.png"))%>
<%} %>