when condition false event.preventDefault working but when condition true event.preventDefault not submit page.
event.preventDefault ? event.preventDefault() : event.returnValue = false;
var url = '@Url.Action("CheckCategory_Name", "CategoryAndSubCategory")';
$.getJSON(url, { Category1: Category1, Category2: Category2, Category3: Category3, Category4: Category4, Category5: Category5 }, function (data) {
debugger;
if (data.isDuplicate != true) {
$("#category").submit();
return true;
}
else {
swal("The Category Name Is Already Exist");
return false;
}
});
});
</script>