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
Post a Comment