The dialogue box parts of this script work but the form doesn't submit
$(document).ready(function(){
$("form#audit_delete_form").submit(function(e) {
e.preventDefault();
var $form = $(this);
if ($form.find('select[name="audit_id_select"]').val() == "") {
$.msgbox("Please select an audit", {
type:"alert",
buttons: [
{type: "submit", value: "OK"}
]
});
}else{
$.msgbox("Are you sure you want to permanently delete this audit?", {
type: "confirm",
buttons : [
{type: "submit", value: "Yes"},
{type: "submit", value: "No"},
{type: "cancel", value: "Cancel"}
]
}, function(result){
if(result == 'Yes'){
$(this).submit()
}
});
}
});
});