bootstrap-ajax-typeahead
bootstrap-ajax-typeahead copied to clipboard
second typeahead not working
when i select a value from my second typeahead, i try to find the second one, like a master detail relation.
Actually my model typeahead never do the ajax call.
var initModelTypeahead = function(brandId) {
$("#model").typeahead({
ajax: {
url: '/brands/' + brandId + '/models',
valueField: "modelId",
displayField: "model"
}
});
};
$("#brand").typeahead({
onSelect: function(item) {
debugger;
console.log(item);
//enable component
$("#model").removeAttr("disabled");
initModelTypeahead(item.value);
},
ajax: {
url: '/brands',
valueField: "brandId",
displayField: "brand"
}
});