I am having an issue with the following logic – because the ajax request runs multiple times and I only want it to run once ?
var currentItem = jQuery('#specialId .myclass');
currentItem.mouseenter(function() {
jQuery.ajax({
type: "POST",
url: "/url/data",
data: "myData=" + dataNow,
cache: false,
success: function(html) {
//do stuff
}
});
});
The problem is that I have a bunch of .myClass which means that the ajax request runs multiple times. How can I get it run only once when the user enters over the currentItem they are entering ?
…and problem solved.