I don't Know is below a valid question? or Just my stupidity.
function IsSlaExists(department) {
var flag = "";
$.ajax({
type: "POST",
data: "Type=ISSLAEXISTS&Department=" + encodeURI(escape(department)),
url: "class-accessor.php",
success: function (data) {
//flag=data;
flag = "YES";
}
});
return flag;
}
alert(IsSlaExists('department'));
i'm trying to return the value of flag
but function returns blanks even if i set the value of flag maually.
what i'm doing wrong?