Problem
I guess you are trying to insert the
div
after the
LinkButton
.
But you have used
append
method, which will append the
div
inside the
LinkButton
, which makes no sense.
And you have another problem of "this" object.
That is, when you are in
Success function, it will refer to the object of
Success method, not the element
LinkButton
.
Solution
- So, you need to store the current object in a variable before any further operation, so that you can use that variable inside the Success function.
- Use .insertAfter()[^] to insert any element after the
LinkButton
. - Ending brackets of
mouseenter
event is also missing.
The code will look something like below...
$('.Tag').mouseenter(function () {
var currentElement = $(this);
var t = currentElement.html();
var tagName2 = encodeURIComponent(t);
$.ajax({
url: 'Test2.aspx?Name=' + tagName2,
success: function (data) {
if (data == "")
return;
$('<div class="TagComment2">slm man khubam</div>').insertAfter(currentElement);
alert('Test');
}
});
});
Suggestion
Check the FireBug Console window to check if there are any other issues or not.