Bug Tracker

Modify

Ticket #10277 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

Not the same result between FF and IE/Chrome

Reported by: mathieu.lallemand@… Owned by:
Priority: low Milestone: 1.7
Component: core Version: 1.6.4rc1
Keywords: Cc:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 3 years ago by rwaldron

  • Status changed from new to closed
  • Resolution set to invalid

JavaScript objects have no order, if you need to maintain an order, use an array

Last edited 3 years ago by rwaldron (previous) (diff)

comment:2 Changed 3 years ago by rwaldron

  • Priority changed from undecided to low
  • Component changed from unfiled to core
  • Milestone changed from None to 1.7

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.