I have a JSON array and a search form with multiple filters. In this search form I have 4 select drop down fields for filtering. How can I search the JSON array based on what the user selects and then display the results after they hit the submit button?
For instance If the user selects "Burger" in the "Food Select Drop Down" field and "Coke" in the "Drink Select Drop Down" field. I want to be able to display all the restaurants that offer both of those items. Is this possible?
var restaurants = [
{"restaurant" : { "name" : "McDonald's", "food" : "burger", "drink" : "coke", "content" : "Lorem ipsum dolor sit amet" }},
{"restaurant" : { "name" : "KFC", "food" : "chicken", "drink" : "pepsi", "content" : "Lorem ipsum dolor sit amet" }},
{"restaurant" : { "name" : "Pizza Hut", "food" : "pizza", "drink" : "sprite", "content" : "Lorem ipsum dolor sit amet" }},
{"restaurant" : { "name" : "Dominos", "food" : "pizza", "drink" : "root beer", "content" : "Lorem ipsum dolor sit amet" }},
{"restaurant" : { "name" : "Popeyes", "food" : "chicken", "drink" : "mist", "content" : "Lorem ipsum dolor sit amet" }}
];
angular.jsI won't put this as an answer but I'd recommend using it for this particular case. Here is a live demo: jsfiddle.net/lacoolj/UACue and the documentation can be found here: docs.angularjs.org/tutorial/step_03