$(function () {
$('#form4').submit(function () {
var val = $("#txtNewServiceTypeCategory").val();
$("#ServiceTypeCategoryName").children("option").each(function () {
var $this = $(this);
if (val == $this.val()) {
alert("ServiceTypeCategory Name is already added! Please Choose Differnt Category Name");
return false;
}
});
$('#someHiddenDiv2').show();
$('#STSave').attr('disabled', 'disabled');
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result) {
$('#someHiddenDiv2').hide();
alert('Saved NewServiceTypeCategory Successfully. Thank you!');
},
error: function () {
alert('Error occured! Plese try again later!.');
$('#someHiddenDiv2').hide();
$('#STSave').removeAttr('disabled');
}
});
return false;
});
});
This return false is not working in the above code even if its showing the popup message other things are executing here,
$("#ServiceTypeCategoryName").children("option").each(function () {
var $this = $(this);
if (val == $this.val()) {
alert("ServiceTypeCategory Name is already added! Please Choose Differnt Category Name");
return false;
}
});
What I am doign wrong in this?
Thanks