I have a very simple json object like the following:
({
"people": [
{
"f_name": "john",
"l_name": "doe",
"sequence": "0",
"title" : "president",
"url" : "google.com",
"color" : "333333",
},
{
"f_name": "michael",
"l_name": "goodyear",
"sequence": "0",
"title" : "general manager",
"url" : "google.com",
"color" : "333333",
}]
})
Of course there are more records but I kept it to two records for the purpose of keeping things simple.
Now that this is returned from my server side code, I run a jquery.each function to form the necessary html and output the result.
Right now what I am doing is sending an ajax call to the server containing my sort info .. e.g. "Title DESC" and re-run an sql query to return the new resultset. But I want to avoid this and use jquery to sort the resulting json to prevent server roundtrips and multiple database access.
how can I achieve this using jquery?