[jQuery] How to wait for load() to finish executing
How can I wait for the load() function to finish before executing the
next line of code? The code that I need to execute after load() is
finished cannot be called within the callback function. I basically
need to return true after the load has finished but not beforehand.
Here's the relevant code:
jQuery(this).cluetip({
cluetipClass: 'jtip',
arrows: true,
dropShadow: false,
hoverIntent: false,
sticky: true,
mouseOutClose: false,
closePosition: 'title',
closeText: 'close',
activation: 'click',
local: true,
hideLocal: true,
onActivate: function() {
var url = jQuery(this).attr("href");
jQuery(this).load(url);
//dont' return true
until load() is finished
return true;
}
});