Lets come to the point here is what I need to achive,
I need achieve the SELECT YOUR VEHICAL functionality using json and jquery,
I have achieved displaying the json data in dropdown list (hardcoded).
Based On Year selection the cars should be displayed for Example if we select 1901 it shows only FORD car option.
Please help on this to achieve using json.
This is what I have done. https://jsfiddle.net/91r9ur4e/
var a = {
Cars: [{
"CarType": "BMW",
"carID": "bmw123"
}, {
"CarType": "mercedes",
"carID": "merc123"
}, {
"CarType": "volvo",
"carID": "vol123r"
}, {
"CarType": "ford",
"carID": "ford123"
}]
};
$.each(a.Cars, function (key, value) {
$("#dropDownDest").append($('<option></option>').val(value.carID).html(value.CarType));
});
$('#dropDownDest').change(function () {
alert($(this).val());
//Code to select image based on selected car id
});
Selected carId should be parameter for next dropdown