自举';s popover在第一次悬停时不显示(ajax)
如下所示的HTML:自举';s popover在第一次悬停时不显示(ajax),ajax,twitter-bootstrap-3,popover,Ajax,Twitter Bootstrap 3,Popover,如下所示的HTML: <a href="#" data-studentId="01" data-toggle="popover">Student1</a> <a href="#" data-studentId="02" data-toggle="popover">Student2</a> <a href="#" data-studentId="03" data-toggle="popover">Student3</a>
<a href="#" data-studentId="01" data-toggle="popover">Student1</a>
<a href="#" data-studentId="02" data-toggle="popover">Student2</a>
<a href="#" data-studentId="03" data-toggle="popover">Student3</a>
js:
$(函数(){
$(“a”).hover(函数(){
var e=$(本);
var studentId=e.attr('data-studentId');
$.ajax({
网址:'http://www.***',
键入:“get”,
数据:{“studentId”:studentId},
数据类型:“jsonp”,
成功:函数(msg){//msg:{名称:“Lisa”,性别:“女性”}
var content=''+msg.name+''+msg.gender+'';
e、 爆米花({
是的,
触发器:“悬停”,
位置:'底部',
容器:'主体',
内容:内容,,
延迟:{“显示”:500,“隐藏”:200}
})
}
})
})
})
当我第一次悬停$(“a”)时,popover不显示。从第二次起,popover显示。我找了几个小时,但没有找到合适的解决办法。我希望从第一次开始就有流行音乐。请帮帮我。非常感谢
$(function () {
$("a").hover(function(){
var e = $(this);
var studentId = e.attr('data-studentId');
$.ajax({
url: 'http://www.***',
type: 'get',
data:{"studentId":studentId},
dataType: 'jsonp',
success: function(msg){//msg: {name: "Lisa",gender: "female"}
var content = '<div>' + msg.name + '</div>' + '<div>' + msg.gender + '</div>';
e.popover({
html: true,
trigger: 'hover',
placement: 'bottom',
container: 'body',
content: content,
delay: { "show": 500, "hide": 200 }
})
}
})
})
})