I'm using validation thing on button click event with jQuery Ajax. This method shows an alert message if return value is 1, else return true and go to button method. That validation and alert showing thing and block button method is working fine. If not want to do anything and return true to hit the button method is not working.
This is my jQuery ajax method.
$(function () {
$('#customerSubmit').on('click', function (event) {
debugger;
event.preventDefault();
var title = $('#Title').val();
var firstName = $('#FirstName').val();
var phoneNo1 = $('#PhoneNo1').val();
var Email = $('#Email').val();
var address1 = $('#AddressLine1').val();
$.ajax({
type: 'POST',
url: '/Customer/IsExistCustomer',
data: { FirstName: firstName, Title: title, PhoneNo1: phoneNo1, AddressLine1: address1, Email: Email },
success: function (data) {
if (data == 1) {
alert('This Customer Already Exist');
return false;
}
else {
return true;
}
}
});
});
});
Please help me to sort out this,
Thanks.