I have a script in that's code is
var isValidate = false;
$.ajax({
url: '/Assessment/ValidDischargeDate',
data: { EpisodePeriodFrom: $('#EpisodePeriodFrom').val(), DischargeOrderDateTime: $('#DischargeOrderDateTime').val() },
type: 'post',
success: function (data) {
console.log('before ' + isValidate); // this show in last
if (data != true) {
alert(data);
isValidate = false;
return false;
}
else {
isValidate = true;
}
}
});
console.log('after '+isValidate); // this show at first
if (isValidate == true) {
// I want something here but this never call because it call in starting I want this should be called after ajax calling.
}
else {
}
Here all is working fine but a problem is occurred This ajax calling is call in last. Please suggest what should I do?