Iam having a hard time searching a JSON document with JS/JQuery. Here is my JSON file I have two select lists in my application, one that selects one of the top-level arrays (150, 300, 600, 900 etc), and one that selects an a value within one of the objects (diameter). I would like to display all matches. I've tried a couple of things already, but I can seem to select the proper array to search in - I can only get them by number (0, 1, 2 etc) not by name (150, 300 etc).
Here is my current function:
$("#btnBeregn").click(function(){
//$("#loader").fadeIn(200);
$("#resultsTable").html("");
var currDiameter = $("#ddlDiameter option:selected").val();
var currDim = $("#ddlRorklasse option:selected").val();
$.getJSON("calctable.json", function(data) {
$.each(data, function(i, v) {
$.each(v, function(x,y) {
if(y.bolts == "32"){
console.log('16 boolts');
}
});
});
});
});