function duplicateCenter(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 addCenterInfo() {
   /* some coding and initializations */
    if (!duplicateCenter(center, email)) {
        return;
    }
    alert('hi');
    alert('hi');
    /* more codes */
}
Anyone please help me to understand, why is above function is getting executed in reverse order ?
Current order of execution is
`hi`
`hi`
`Duplicate Entry Found !!`
where as expected execution should only be Duplicate Entry Found !! and it should come out from the function.
 
     
     
     
     
    