![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 70 Pomógł: 0 Dołączył: 27.05.2008 Ostrzeżenie: (0%) ![]() ![]() |
Czesc
Mam taki problem ze nie wiem jak zrobic żeby funkcja Test poprawnie widziała zmienną thisUser.imie? Czym to moze być spowodowane ze jej nie widzi (wypisuje undefined) ? wiem ze po przeniesieniu jej wywolonia do funkcji anonimowej w request jest ok ale chce miec wywolanie Test w funkcji init po pobraniu informacji o userze. Czy mam ktos pomysł? nie chce tez zmieniać thisUser.imie na zmienną globalną imie chce zeby byla ona częścia obiektu User. Ponizej załączam kod: CODE function User(id){
var thisUser = this; this.UID = id; this.imie = ""; this.nazw = ""; this.login = ""; this.phone = ""; this.email = ""; this.init = function(){ thisUser.getUserInfo(); // thisUser.Test(); } this.getUserInfo = function(){ var url = host + 'getUserInfo/'+thisUser.UID; var wynik; new Ajax.Request(url,{ method:'post', onSuccess: function(e) { wynik = eval('(' + e.responseText + ')'); thisUser.imie = wynik[0].imie; thisUser.nazw = wynik[0].nazw; thisUser.phone = wynik[0].phone; thisUser.email = wynik[0].mail; thisUser.login = wynik[0].login; } }); } this.Test = function(){ alert("LOGIN:"+thisUser.imie); } ... ... ..... } |
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 08:39 |