How to sort a JS object of objects?

后端 未结 5 1823
礼貌的吻别
礼貌的吻别 2020-12-18 03:03

I have built an object in PHP, used JSON_encode function and send it as a JSON string to my JS script via ajax. Then I convert it back to an object. The problem I am havin

5条回答
  •  隐瞒了意图╮
    2020-12-18 03:56

    Just cycle through your data and sort it. I'm not using the most efficient sorter but the ideas is there.

    var data = toArray(AJAX_Returned_JSON); // function to convert object to array
    var sortedData = null;
    
    for(var i=0; i

提交回复
热议问题