Returning bool in ajax request
Hello All,
I have a common ajax method like the one below,
function callService(url, data, success, failure) {
$.ajax({
url: requestUrl,
method: "POST",
contentType: "application/json; charset=utf-8",
dataType: 'JSON',
data: { model: JSON.stringify(model) },
success: successCall,
error: failureCall
});
Now somewhere else, I am using the above method
function getTheData()
{
callService(url, data, newFunction, function (error) { });
}
Now in the newFunction,
function newFunction()
{
//Somefunction which retrurn boolean
if(data.d.length > 0)
return true;
else
return false;
}
In this how I can return boolean variable to callService or getTheData method?
Thanks,
Shannila