I have the following JSON object:
PHP Code:
var articles = {
"ABC123" : { "brand" : "Fruit of the loom", "artgroup" : "sweaters", "colour" : "black" },
"XYZ789" : { "brand" : "Levis", "artgroup" : "pants", "colour" : "blue" }
};
, and I want to filter out the article numbers (only one in this test case) where the brand is levis. In the function call, I.d. like to be able to use the property name as an argument, i.e.
PHP Code:
Filter("brand","Levis");
function Filter(searchFor,Property)
{
for (var key in articles)
{
...
}
}
but, I don't know how to access the property name. How can I do it?