【发布时间】:2014-07-30 04:21:14
【问题描述】:
我正在使用 tooltipster 插件工具,在该工具中我得到了 甘特图,其中包含一些 td 给定的 id。
所以,id 被定义了,鼠标悬停在它上面会得到 ajax 数据并相应地显示出来。
下面是我的代码的 sn-p。这里的问题是工具提示仅在我将鼠标单击td 几次后才出现。此后,它工作正常。
我可以在调试窗口中看到调用了 ajax 页面并出现以下错误:Tooltipster: one or more tooltips are already attached to this element: ignoring. Use the "multiple" option to attach more tooltips. jquery.tooltipster.min.js:1
$(document).ready(function () {
$('td[id]').tooltipster({
// content: 'Loading...',
functionBefore: function(origin, continueTooltip) {
// We'll make this function asynchronous and allow the tooltip to go ahead and show the loading notification while fetching our data
continueTooltip();
var idval=0;
// Next, we want to check if our data has already been cached
//if (origin.data('ajax') !== 'cached') {
$.ajax({
type: 'GET',
url: 'getDetails.php',
data:idval,
success: function(data) {
// Update our tooltip content with our returned data and cache it
//alert("Data is : "+data);
var finalData = 'Total Data : 300 <br> Total Completed : 200';
//alert("DATA");
//origin.tooltipster: $('<span>testst<strong>This text is in bold case !</strong></span>')
origin.tooltipster({
content: finalData,
multiple: true,
contentAsHTML: true
});
//origin.tooltipster({content: data,contentAsHTML: true}).data('ajax', 'cached');
}
});
//}
}
});
});
【问题讨论】:
标签: javascript jquery ajax tooltipster