I have the following code:
$('#btnCreate').click(function (e) {
var object;
if ($(this).hasClass('Create')) {
Action = 'Create';
}
if ($(this).hasClass('Update')) {
Action = 'Update'
}
switch(Action) {
case x:
object=GetFirstFunction();
break;
case y:
GetSecondFunction();
break;
}
$.ajax({
//passing here all the required things to make a call
data:object,
//something
});
});
function GetFirstFunction(){
var obj = new Object();
$('.dlist').each(function (e) {
if ($(this).val() == '') {
alert('Please select all the dropdowns');
return false;
}
obj.Id=$('#Id').val();
obj.Dept=$('#Dept').val();
obj.Position=$('#Position').val();
return obj;
});
}
How to stop making an AJAX call if any one of the dropdown's values are not selected. I tried e.stopPropagation();
But it is not working any help is appreciated.