Translating variable sometimes does not appear in the result after an ajax call

Viewed 16

I was using the code bellow to retrieve via ajax a value from a database and then translate it with t object (dictionary). Sometimes it is translated other's nothing appears.

In the beginning of the page i read a file dictionary to an objet (t). Could it be because of the time to read de file?

I am stuck :\ I would appreciate very much if someone could give an hint how to solve this mistery?

var json = JSON.parse( response );          // success function
var type_aux=t[json[0].type];
alert("->"+type_aux+"<-");
$('#TYPE_SHOW').html(type_aux); 
0 Answers
Related