php json_encode($object) 结果是
[{"price_id":"1","website_id":"0","price_qty":2,"price":"90.0000"},
{"price_id":"2","website_id":"0","price_qty":5,"price":"80.0000"},
{"price_id":"3","website_id":"0","price_qty":8,"price":"70.0000"}]
有人告诉我,var sorted = arrayWithJsonData.sort(function(a,b){}
如何使用上面的 php json_encode($object) 到 arrayWithJsonData。我使用了以下方式,但它显示 TypeError: object.sort is not a function
首先:在php中我做了:echo '<div style="display:none;" id="object">'.$object.'</div>';
然后在jquery中使用
var object=jQuery("#object").text(); // first sort the array var sorted = object.sort(function(a,b){}