Hi all,
i had the following question.
i want to update my subcategory select list when the user select a specific leadcategory and show in other select list the subcategories.
The problem is that i can't figure out when i'm selecting a another leadcategory my previous subcategory has to remove and fill with the new data depending wich leadcategory i selected.
For now i've the following code.
The data i parse is a json encode who looks like:
Website.Config = {"categorieen":{"1":{"1":"Navullingen ","2":"Potloden"},"2":{"3":"Navullingen","6":"potloden","7":"testSubcategorie"}}}
function onChangeSubcategorie(){
categorieen = Website.Config.categorieen;
$("form#overviewFilter select#cat").change(function() {
var hoofdCategorie = $(this).val();
var subcategorieen = categorieen[hoofdCategorie];
for(var c in subcategorieen ) {
var tekst = subcategorieen[c];
if(hoofdCategorie == 1) {
$('form#overviewFilter select#scat').append("<option value="+tekst+">"+tekst+"</option>");
}else if(hoofdCategorie == 2) {
$('form#overviewFilter select#scat').append("<option value="+tekst+">"+tekst+"</option>");
}
}
});
}
thank you for helping.