For example, I have a json file with cars from Ford and Volkswagen. Now I have a var where 'ford' or 'volkswagen' is stored. How can I use this var in combination with the data selection.
$.getJSON('file.json', function(data) {
$.each(data.ford, function(i, item) {
//do something
});
});
$.getJSON('file.json', function(data) {
$.each(data.volkswagen, function(i, item) {
//do something
});
});
I mean something like
var brand = 'ford';
data.+brand