jQuery method of sorting output from JSON data

  • 2020-06-19 09:44:03
  • OfStack

This article gives an example of how jQuery sorts the output of JSON data. Share to everybody for everybody reference. Specific implementation methods are as follows:


$.getJSON('URl',function(data){
  data.sort(function(a,b){return a.demoname-b.demoname});
  for(i=0;i<data.length;i++){
   alert(data[i].demoname)
  }
})

Hopefully, this article has been helpful in your jQuery programming.


Related articles: