I have a function that issues an AJAX call (via jQuery). In the complete
section I have a function that says:
complete: function(XMLHttpRequest, textStatus)
{
if(textStatus == "success")
{
return(true);
}
else
{
return(false);
}
}
However, if I call this like so:
if(callajax())
{
// Do something
}
else
{
// Something else
}
The first is never called.
If I put an alert(textStatus)
in the complete
function I get true, but not before that function returns undefined
.
Would it be possible to pass a callback function to my callajax()
method? Like:
callajax(function(){// success}, function(){// error}, function(){// complete});