javascript - jQuery ordered actions -


does know how make jqery function has more 1 action , every action fired after precedent complete like:

$('#myelement').addclass('loading').load(loadurl).removeclass('loading'); 

here first action adding class name ok, second ok, problem comes last action supposed remove class after load finished, here fired before loading finished , cancel first action none of first nor third action present.

thanks.

here go:

$('#myelement').addclass('loading').load(loadurl, function() {     $(this).removeclass('loading'); }); 

this assigns anonymous function callback load method, invoked when load operation completed.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -