我使用bootstrap popover来显示图像,但它似乎不起作用。电影的标题正在弹出窗口上显示,但不是电影的图像。请帮助!
$.ajax({
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=XXXX&q=" + name + "&page_limit=5",
dataType: "jsonp",
success: function (response) {
$(".display-movie").empty();
var ul = $(".display-movie");
console.log(response);
for (var i = 0; i < response.movies.length; i++) {
var img = $("<img>").attr("src", response.movies[i].posters.thumbnail)
.css({
width: 200,
height: 200,
margin: 20
}).append(aend);
var astart = $("<a>", {
href: '#',
rel: 'popover',
title : response.movies[i].title,
}).append(img);
var aend = $("</a>");
var div = $("<div></div>")
.append(astart)
.append(response.movies[i].title);
$("<li></li>")
.append(div)
.appendTo(ul);
var popoverimg = '<img src = "' + response.movies[i].posters.thumbnail + '"/>';
$(".display-movie").popover({
title : response.movies[i].title,
content: popoverimg,
html : true
});
}
}
});
在html中我有:ul class =“display-movie”