PDA

View Full Version : Loading Language-File



gnadirap
27 May 2010, 3:06 AM
Hi all

I have a little problem. I was writing a little program, which has languages. the output of the PHP-Language Files are in json.

now, to my Problem.

see code:


Ext.onReady(function(){
getLanguage();


function getLanguage(){
Ext.Ajax.request({
url:connection,
params:{
method:'loadLanguage',
},
callback: function(result, response, success){
//console.info(success.responseText) ;
}
});
}
}

the Output uf the Request is right. but how can i tell the function to put the success Text int a variable .. (something like this)



Ext.onReady(function(){
var lang = getLanguage();
function getLanguage(){
Ext.Ajax.request({
url:connection,
params:{
method:'loadLanguage',
},
callback: function(result, response, success){
//code has to be changed somehow
}
});
}
}


Hopefully I'm on the right way.. or do I have a missunderstanding?


Wished Usage:

I want to use the "lang" variable like this:
a.e.

title: lang.title.response


Please help me, or give me some links.. Many thanks for your help

kind regards


gnadirap