I have a ajax request that is returning to me an object that looks roughly like the following:
[
{category: "Test Category", id: "1", name: "Test", language: "English"},
{category: "Test Category", id: "2", name: "Test2", language: "English"},
{category: "A test", id: "3", name: "Test3", language: "Spanish"},
{category: "Test Category", id: "4", name: "Test4", language: "Spanish"}
]
Basically I need a way to do the following:
- List all categories that exist in ONLY English or Spanish
- List all ID's that exist in a specified language
- List all ID's that exist in a specified category
Now I'm fairly sure the best route to do this is to create my own temp arrays that can house that data but I'm not confident enough in Javascript to write the correct loop to get that data. I know in PHP I'd do something like $category['Test Category'][] = 3 while looping.
The idea is I need the ability to filter things based on the user selecting to filter by English and then by a category within that.
Can someone point me in the right direction?
$arr[] = $xisarr.push(x)arr = arr || []which creates a new array if it doesn't exist.