这是我第一次使用工具提示,并对其进行了大量研究。我使用 jquery 网站来获取大部分信息。我希望我的工具提示在鼠标单击超链接时显示动态数据。我在链接中添加了标题,并在下面有以下代码:
var t = 1000;
$(document).tooltip({
content: '... waiting on ajax ...',
open: function(evt, ui) {
var elem = $(this);
$.ajax({ type: "POST",url:'/GetTooltip/', data: 80140}).always(function() {
elem.tooltip('option', 'content', 'Ajax call complete');
});
setTimeout(function(){
$(ui.tooltip).hide('destroy');
}, t);},
position: {
my: "center bottom-20",
at: "center top",
using: function( position, feedback ) {
$( this ).css( position );
$( "<div>" )
.addClass( "arrow" )
.addClass( feedback.vertical )
.addClass( feedback.horizontal )
.appendTo( this );
}
}
});
我并不完全了解关于 always 函数的 ajax 调用语法以及如何让数据显示在我的工具提示上。GetTooltip 返回 JSON 数据,我只想发布到 GetTooltip 脚本和返回的数据以显示在我的工具提示上。目前我的 ajax 没有发布任何内容。