Look at my code:
function dialogTexts() {
var langText = $.ajax({
type: 'GET',
url: '/main/getdialogtexts',
dataType: 'json'
});
langText.done(function(data) {
//data contains a array returned correctly from php
//The data.delete is returned correctly from php. data.delete contains a string
return data.delete;
});
langText.fail(function(ts) {
alert(ts.responseText);
});
}
Why does the variable lang
get undefined when calling above function?
var lang = dialogTexts();