I know that when getting return data from webmethods in javascript this code is valid, but how about if it is a return from another js method?
The alert is never ran so I am thinking no, but I want to make sure it is this and not other code throwing the error:
function previousWinner() {
//Webservice call
services.isUserAWinner(ID, events, function (response) {
//Code
//Return
return true;
}
//Return
return false;
});
}
And later in my code I call this
previousWinner(function (response) {
alert(response);
//Check to see if user is a winner
if (!response) {
//Check likes
hasUserLiked();
}
});
Does previousWinner(function (response) { only work on web method calls?
This is how you should define previousWinner where ‘code’ is some boolean that tells you to run the callback.