Obiekt Javascript zwraca wartości śmieciowe
Próbuję przypisać wartości do obiektu javascript, a gdy to robię, niektóre wartości śmieci kończą się tam, co wydaje się metodami tablicowymi, takimi jak „push”, „pop”, „splice” itp. Poniżej znajduje się mój kod.
function myTest(){
var userArray = new Object();
var req = new Request.JSON({
url: '/myTest.php',
method: 'post',
noCache: true,
data: 'userID=999',
onSuccess: function(json){
for(var key in json){
userArray = json[key];
for (var row in userArray){
alert(row) // This returns values like '$family','push','pop', 'reverse' etc.
}
}
},
onException: function(xhr){
alert("Unable to process your request");
},
onFailure: function(xhr){
alert("Unable to connect to the server");
}
}).send();
}
Nie wiem, czego tu brakuje, ale wygląda na to, że jestem. Każda pomoc na ten temat byłaby bardzo mile widziana.