我有一个显示用户列表的页面。现在我想如果用户将鼠标悬停在用户名称上,那么应该从服务器&中获取该特定用户的详细信息。显示在工具提示中
我怎样才能实现它,我知道我必须在帖子中传递数据ID或其他东西,但我在这个jquery中是全新的,所以我需要一个小帮助
$('.tooltip').tooltipster({
content: 'Loading...',
// 'instance' is basically the tooltip. More details in the "Object-oriented Tooltipster" section.
functionBefore: function(instance, helper) {
var $origin = $(helper.origin);
// we set a variable so the data is only loaded once via Ajax, not every time the tooltip opens
if ($origin.data('loaded') !== true) {
$.get('http://example.com/ajax.php', function(data) {
// call the 'content' method to update the content of our tooltip with the returned data
instance.content(data);
// to remember that the data has been loaded
$origin.data('loaded', true);
});
}
}
});