I have a situation where I need to get a value from ajax call, then pass that value to a callback function. Just like this:
function getValue(callback){
var val = getfromajax();
//need to return value and then execute the callback here
return val;
callback();
}
var myval = getValue(function(){
alert(myvalue)
})
In the example above in the functon showValue I need to call getValue and use the returned value and pass it to callback function (which alerts it).
Is there a way to do that?