Currently my ajax request is getting JSON in this format:
{
id: 1,
teamname: "Chicago Blackhawks",
league: NHL
wins: 5
losses: 10
account_id: 3444,
},
{
id: 2,
teamname: "Chicago Bulls",
league: NBA
wins: 15
losses: 2
account_id: 3444,
}
but to use an autocomplete jquery plugin, I need it in this format:
[
{ value: 'Chicago Blackhawks', data: { category: 'NHL' } },
{ value: 'Chicago Bulls', data: { category: 'NBA' } }
]
Basically I need to only get two fields and format it under value and data -> category instead of name and league. What is the best way to go about this?