Skip to content

Instantly share code, notes, and snippets.

@nerdbeere
Created January 29, 2014 13:44
Show Gist options
  • Select an option

  • Save nerdbeere/8688247 to your computer and use it in GitHub Desktop.

Select an option

Save nerdbeere/8688247 to your computer and use it in GitHub Desktop.
In case you need car brands and their models just go to autoscout24.de and use this gist.
var brands = [];
$('#make1 option').each(function() {
var id = $(this).val();
var name = $(this).text();
var obj = {
id: id,
name: name,
models: []
};
if(typeof navMakeModelData['m' + id] !== 'undefined') {
var models = navMakeModelData['m' + id].c;
for(var i = 0; i < models.length; i++) {
if(typeof navMakeModelData[models[i]] === 'undefined') {
continue;
}
var modelName = navMakeModelData[models[i]].t;
obj.models.push({id: models[i], name: modelName});
}
}
brands.push(obj);
});
console.log(JSON.stringify(brands));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment