I have this form:
<form data-ajax="true" data-ajax-method="post"
data-ajax-url="@(Url.Action("DeleteUserModel", "AccountAdmin"))"
data-ajax-mode="replace" data-ajax-update="#deleteDiv"
data-ajax-loading="#ajax" data-ajax-failure="failed"
data-ajax-success="ondeletesuccess">
<input type="hidden" name="userName" value="@user.UserName" />
<input type="submit" class="btn btn-danger" onclick="ConfirmDelete"
value="Delete" />
</form>
and the javascript in the main page:
<script>
function ConfirmDelete() {
var result = confirm("Are you sure to delete?");
if (!!result) {
return true;
}
return false;
}
</script>
But the form deletes the record without showing confirmation. how to correct this?