Make a function wait until another send return
<p>I have a function called "myCall()" like this:</p>

<pre><code>function myCall() {

    $.ajax({
        type: 'get',
        url: 'file.php?id=10',
        dataType: 'json',
        cache: false,       
        success: function(data) {
            return data;
        },
        error: function(data) {
            alert('error!');
        }
    });

}
</code></pre>

<p>As you can see, this funcion call the "file.php?id=10" and get a return.</p>

<p>That's ok.</p>

<p>But here is my localFunction():</p>

<pre><code>function localFunction() {
    show = myCall();
    alert(show);
}
</code></pre>

<p>As you can see, the localFunction() alert shows "undefined".</p>

<p>How can I make the show = myCall() wait the response before go to next code line?</p>

<p>Fiddle: </p>