1
In PHP:
$arr = array( 10=>"ten", 5=>"five", 2=>"two"); return json_encode($arr);
In JS - $.ajax():
success: function(data){ console.log(data);}
2
What I see in console is :
Object {2: "two", 5: "five", 10: "ten"}
,
I want to use for(var i=0; i< data.length,i++)
but failed.
Finally it works in this way : for(var i in data)
3
My Question: Why the array is sorted? I want the array to keep unsorted.
Anyone helps me?