I′m using the jQuery UI tooltip script. Therefore I have tooltip links with different "data-id" values like that:
<a tooltip-link data-id="12555"></a>
<a tooltip-link data-id="38"></a>
The "data-id" values get sent with ajax to my server sided script and the ajax-results are shown in the tooltips.
Additionally I want to dynamically generate the link names out of a certain part of this ajax-response.
The part of the ajax-response which should be used for the link names is the content of every <div class="">
which contains parts of the item-title
class:
ajax response
<div class="item-title">Item12555</div>
<div class="item-title3">Item38</div>
This is my working tooltip-jQuery script so far. How can I implement the generation of the link names?
jQuery(function($) {
$( "[tooltip-link]" ).each(function(i) {
var id = $(this).attr("data-id");
$(this).tooltip({
tooltipClass: "test",
content: function( response ) {
$.ajax({
url: "/datenbank/itemscript.php",
data: {
'var': id
},
type: "GET"
})
.then(function( data ) {
response( data );
});
},
items: "*"
});
})
});