I have one error in my code.
Error is a my link is not same
$(".demo-ajax").hovercard({
detailsHTML: hoverHTMLDemoAjax,
width: 350,
onHoverIn: function () {
// set your twitter id
var projeID = $('a.demo-ajax').attr("href").match(/projeID=([0-9]+)/)[1];
var linkler = "bilgiler.php?id=" + projeID;
$.ajax({
url: linkler,
context: document.body,
success: function(data){
alert(linkler);
$('.twitter-username').html(data);
}
});
}
});
and then,
<a href="proje.php?projeID=2" class="demo-ajax">zzzzzz</a>
<a href="proje.php?projeID=1" class="demo-ajax">ssss</a>
if i go to “ssss” , i have alert : “proje.php?projeID=2”
Why i have this error.
Have a good day.
new code blocks :
var hoverHTMLDemoAjax = '<hr><p><p></p><label class="twitter-username">the user</label></p><ul id="demo-cb-tweets"></ul>';
$(".demo-ajax").hovercard({
detailsHTML: hoverHTMLDemoAjax,
width: 350,
onHoverIn: function () {
// set your twitter id
var projeID = $(this).attr('href').match(/projeID=([0-9]+)/)[1];
var linkler = "bilgiler.php?id=" + projeID;
alert(linkler);
$.ajax({
url: linkler,
context: document.body,
success: function(data){
$('.twitter-username').html(data);
}
});
}
});
if i use this,
i don’t have any alert and i go to difference link and i see the user ..
You need to refer to the current element:
By having
$('a.demo-ajax').attr("href")you always read the href attribute of the first element in the collection, if such exists.Edit: Looks like the
hovercardmethod is being applied to some containing<div>element rather then to the anchor itself, so change the code to: