Hi,
Im trying to make a function return a string from a ajax call.
This is my 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;
}
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?
Thanks.