function checkForDuplicate(center, email) {
$.ajax({
type: "POST",
url: "../staff/staffDA.php",
data: "funId=-4¢er=" + center + "&email=" + email,
success: function (data) {
if (data.split('|')[0] === 'true') {
alert('Duplicate Entry Found !!\r\n' + data.split('|')[1]);
return false;
}
return true;
}
});
return true;
}
function processCenterInfo() {
/* performing necessary steps */
if (!checkForDuplicate(center, email)) {
return;
}
alert('hello');
alert('hello');
/* additional code */
}
Can someone explain why the above functions are being executed in reverse order?
Current sequence of execution is
`hello`
`hello`
`Duplicate Entry Found !!`
The expected execution should only be Duplicate Entry Found !!
, and it should exit the function.