![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 1 873 Pomógł: 152 Dołączył: 9.04.2006 Skąd: Berlin Ostrzeżenie: (0%) ![]() ![]() |
Witam, mam pewien problem. W php generuję sobie tablicę
Pobieram to ajaxem i evaluje co daje mi Kod var Players = new Array(); Players['bim'] = new Array(); Players['bim']['name'] = 'bim'; Players['bim']['x'] = 13; Players['bim']['y'] = 15; showPlayersPosition(Players); Funkcja Kod function showPlayersPosition(array) { for(i in array) { $('#otherPlayers').html(array[i]['name']); } } Niestety nie wyświetla mi nazwy. Jak dam jednak [i]['x'] to działa ;/ (po uprzednim wywaleniu generowania ['name'] w php. Wie ktoś może co jest? EDIT: Jak dam w showPlayersPosition alert(array[i]['name']); to wyświetla Bim -> [pusto] -> [pusto] Czemu robią się 2 puste tablice? Ten post edytował bim2 13.09.2008, 15:24:12 -------------------- |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 603 Pomógł: 131 Dołączył: 24.07.2007 Skąd: Górny Śląsk Ostrzeżenie: (0%) ![]() ![]() |
Przetestowałem Twój kod na sucho (bez ajaxa) i działa bezproblemowo. alert(array[i]['name']); też.
-------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 13.07.2025 - 04:45 |