jquery having issue with global variable inside function ajax function
<p>Following is the code:</p>

<pre><code>var ret;
function fetch_data(param1){
  $.post(param1,
        function(data){
          if (data){
            ret = data*2;
            console.log("data", ret);
          }
          else{
            ret = 15;
            console.log("no data")
          }
        });
  return ret;
}

function hello(){
  ret = fetch_data("/post_data");
  console.log("from the main function", ret);
}
</code></pre>

<p>The above is a simplified schema of how i am working with things. 
i make a post request to a url and try to get the value, based on the returned value i manipulate the value and try returning it back to the function. 
The <code>console.log</code> shows a value inside the <code>fetch_data</code> function, but not within the <code>hello</code> function. Meaning no value is returned. Where am i getting it wrong?</p>
