Side navigation
#10277 closed bug (invalid)
Opened September 14, 2011 02:54PM UTC
Closed September 19, 2011 04:06PM UTC
Last modified September 19, 2011 04:27PM UTC
Not the same result between FF and IE/Chrome
Reported by: | mathieu.lallemand@ncitl.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.7 |
Component: | core | Version: | 1.6.4rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Let say you have this kind of JSON file :
{"10233401":"10010","10001101":"5519"}
And you use this code in jQuery to fill your select element named "debugSelect":
$.getJSON("data.json", function(data){ $.each(data, function(key, value) { options += "<option value='"+key+"'>"+value+"</option>"; }); $("#debugSelect").html(options); });
Expected Result : 10010
FF Show : 10010
IE/Chrome show : 5519
I spent 2 days to find this. I suppose that IE Ajax part sort the JSON result. IMHO it may be better to use the sorting order given by the JSON file.
Thanks.
Attachments (0)
Change History (2)
Changed September 19, 2011 04:06PM UTC by comment:1
_comment0: | JavaScript objects have no order → 1316449637980263 |
---|---|
resolution: | → invalid |
status: | new → closed |
Changed September 19, 2011 04:27PM UTC by comment:2
component: | unfiled → core |
---|---|
milestone: | None → 1.7 |
priority: | undecided → low |
JavaScript objects have no order, if you need to maintain an order, use an array