Skip to content

Instantly share code, notes, and snippets.

@ChrisBuchholz
Last active December 26, 2015 15:38
Show Gist options
  • Save ChrisBuchholz/7173688 to your computer and use it in GitHub Desktop.
Save ChrisBuchholz/7173688 to your computer and use it in GitHub Desktop.
var getCars = function () {
$.getJSON(url, function(cars) {
var $list = $('#min-liste-med-biler');
for (var i = 0; i < cars.length; i += 1) {
addCarToViewElm(cars[i], $list);
}
});
};
var addCarToViewElm = function (car, $elm) {
var $car = $("\
<li>\
<header><h1 class='name'></h1></header>\
</li>");
$car.find('.name').text(car.name);
$elm.append($car);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment