Created
August 17, 2014 13:26
-
-
Save malles/f2275d6c29b1313f29ee to your computer and use it in GitHub Desktop.
scrape automerken
This file contains 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
(function ($) { | |
var make = $('select#selectMake'), i = 0, | |
merken = make.children().map(function(){ | |
return {val:$(this).attr('value'),text:$(this).text()} | |
}).get(); | |
$.modellenLijst = {}; | |
$.each(merken,function(){ | |
var merk = this; | |
if (merk.val) { | |
$.ajax({ | |
type: "GET", | |
url: '/home/models.html?makeId=' + merk.val + '&lang=de', | |
data: {} | |
}) | |
.done(function (data) { | |
console.log(data); | |
var modellen = $('<div></div>').append(data).find('option').map(function () { | |
return $(this).text().trim() | |
}).get(); | |
console.log(merk.text, modellen.length); | |
$.modellenLijst[merk.text.trim()] = modellen | |
}) | |
} | |
i++; | |
}); | |
})(jQuery); | |
jQuery('body').text(JSON.stringify(jQuery.modellenLijst)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment