Iam calling the Ajax function
function validateemp(){
var exists="";
$.ajax({
url: "emp.php",
async: false,
dataType: "json",
data: {'param1': $("#param1").val(), 'empno': $("#empno").val()},
success: function (data) {
exists = data.status;
}
});
alert("exists==>"+exists);
return exists;
}
Iam Not able to return the value of “exists” value .Iam able to get the exact value of “exists” whether it is true or false.Due to this value not returning true or false Iam not able to build the prompt .if i return explicitly true or false iam able to build the prompt .What iam Doing wrong
If I understand your question and comments correctly, your JSON output contains a string whereas you want to return a boolean. If so, then something like this should work: