Function to return variable from ajax call
<p>Im trying to make a function return a string from a ajax call.</p>

<p>This is my code:</p>

<pre><code>function GetText(getThis) {  
    var current = GetMarketAndLang();  
    var dataToReturn = "Error";  
    $.get('inc/ajaxGetText.php', {lang : current.lang, market : current.market, name : getThis},  
        function(data){  
            dataToReturn = data;  
    });  
    return dataToReturn;  
}
</code></pre>

<p>Using firebug i can see that the ajax call is correct but the whole function still returns the text "Error" instead of "and". Why is that and what can i do?</p>

<p>Thanks.</p>
