I am trying to figure out how I can use an if statement to filter my JSON results on a page. Each recipe has its own category and I am trying to be able to filter the information based on type category type and other paramaters. I only included some code for people to get the idea but when I run this I get nothing. Here is my code:
$.each(json, function(i, item) {
if (item.recipeCategories == "fall") {
//show correct items in div
}
});
var json =
[
{
"recipeName":"Crispy Zucchini Fritte with Lemon Aioli",
"recipeCategories":[
"appetizers",
"spring"
],
},
{
"recipeName":"Hummus Tahini",
"recipeCategories":[
"desserts",
"fall"
],
}
]