js to populate slider
This commit is contained in:
parent
c2058c6bd5
commit
514198a884
|
@ -3,7 +3,21 @@ $(function() {
|
|||
e.preventDefault();
|
||||
var q = $('#search').val();
|
||||
$.getJSON("/search/", {'q': q}, function(data) {
|
||||
console.log(data);
|
||||
var $container = $('.overview');
|
||||
$container.empty();
|
||||
for (var i=0; i<data.length; i++) {
|
||||
var $li = getLi(data[i]);
|
||||
$li.appendTo($container);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getLi(image) {
|
||||
var $li = $('<li />').data("data", image).click(function() {
|
||||
var data = $(this).data("data");
|
||||
alert(JSON.stringify(data));
|
||||
});
|
||||
var $img = $('<img />').attr("src", image.Thumbnail.Url).appendTo($li);
|
||||
return $li;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user