Pass output as input argument for the callback : <p>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:</p>

<pre><code>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)
})
</code></pre>

<p>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).</p>

<p>Is there a way to do that?</p>
