I am making an AJAX call to retrieve some data via a POST request. Then, I am using that data to create a tooltip. Here's the code:
j$("#selectorID").one('mouseover',
function(e) {
var ticketType = e.target.classList[2];
var ticketID = j$(e.target).data("ticket-id");
j$.post("/Some/Url/",
{ "ticketID":ticketID, "ticketType":ticketType },
function(r) {
var title = r["title"];
var tooltip = j$(e.target).kendoTooltip( { content: title, position: "top" } ).data("kendoTooltip");
if (j$(e.target).is(":hover")) { tooltip.show(); } // Race condition
}
);
}
);
I believe there is a race condition because the tooltip, even after my mouse moved off of it, will still appear. Then I have to put my point on the element, and then move it off again, to make it disappear. What can be done to solve this?
I tried a few different things, including the if (j$(e.target).is(":hover"))
condition you see there. But it still doesn't do the trick.