This is due to the asynchronous nature of the AJAX request - the function returns before the response is returned. To solve this problem, you should use the full feature $.ajax()and install asyncon false:
function GetText(getThis) {
var current = GetMarketAndLang();
var dataToReturn = "Error";
$.ajax({
url: 'inc/ajaxGetText.php',
type: 'GET',
async: false,
success: function(data) {
dataToReturn = data;
}
});
return dataToReturn;
}
This makes the script wait until the request is returned before the script completes, so the variable is now the one returned from the AJAX call.