On Jan 28, 2009, at 3:34 PM, Michael Geary wrote:
async:false doesn't just freeze the entire browser, in many browsers
it may
freeze every browser window as well, even windows open on other sites.
Adam, why can't the code you need to execute be called from the
success
callback function?
-Mike
Hi Adam,
I'm with Ricardo and Mike: Put the code in the callback of the .load()
method.
Also, you might be better off using the onShow option than the
onActivate one.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
From: Ricardo Tomasi
You can use async: false, check the docs:
http://docs.jquery.com/Ajax/jQuery.ajax
That's the closest thing to a 'pause' in JS, but that is not
good as it will freeze the whole browser while waiting for
the server response. The best solution would be to use the
load callback, but then you can't change the return value.
$(this).load(url, function(){
//do whatever returning true would do
});
On Jan 28, 3:52 pm, jay <jay.ab...@gmail.com> wrote:
This could be accomplished using a synchronous xmlhttp call (does
jQuery even support this?), or you could put a while loop
before the
return true to poll a variable that is set in the callback.
You would
probably want to set the variable if there is an error as
well so that
the browser doesn't freeze too long.
On Jan 28, 10:33 am, Adam <apcau...@gmail.com> wrote:
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;
}
});