来自jquery的响应已损坏
以某种方式,response.data.pool.account
assoc数组按键排序?!
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
var success = function(response){
console.log(response.data.pool.account);
};
控制台(firebug)中的{"data":{"pool":{"account":{"176":{"account_id_":"999"},"169":{"account_id_":"1110"},"189":{"account_id_":"1120"},"190":{"account_id_":"1130"},"173":{"account_id_":"2100"},"188":{"account_id_":"2200"},"184":{"account_id_":"3010"},"185":{"account_id_":"3020"},"186":{"account_id_":"4010"},"187":{"account_id_":"4020"},"179":{"account_id_":"5000"},"181":{"account_id_":"9999"},"167":{"account_id_":"14261"},"168":{"account_id_":"14262"},"172":{"account_id_":"15000"},"171":{"account_id_":"15261"},"170":{"account_id_":"15262"},"177":{"account_id_":"15500"},"174":{"account_id_":"16000"},"182":{"account_id_":"16500"},"175":{"account_id_":"17000"},"183":{"account_id_":"17500"},"180":{"account_id_":"19999"}}}}}
167
Object { account_id_=14261}
168
Object { account_id_=14262}
169
Object { account_id_=1110}
170
Object { account_id_=15262}
171
Object { account_id_=15261}
172
Object { account_id_=15000}
173
Object { account_id_=2100}
174
Object { account_id_=16000}
175
Object { account_id_=17000}
176
Object { account_id_=999}
177
Object { account_id_=15500}
179
Object { account_id_=5000}
180
Object { account_id_=19999}
181
Object { account_id_=9999}
182
Object { account_id_=16500}
183
Object { account_id_=17500}
184
Object { account_id_=3010}
185
Object { account_id_=3020}
186
Object { account_id_=4010}
187
Object { account_id_=4020}
188
Object { account_id_=2200}
189
Object { account_id_=1120}
190
Object { account_id_=1130}
答案 0 :(得分:2)
Javascript对象不保证其密钥的任何特定顺序。
由js引擎根据需要在内存中布局属性。
如果您的代码依赖于键的顺序 - 您需要从现在开始停止它(通过使用数组)。