Created
January 29, 2014 13:44
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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