javascript - I want to make sure function comes after loading of external HTML -
how make sure alert comes after loading of external html?
function changecontent(){ $('#contentmain').load("contentmain.html", function(){ alert("something"); } )}
i've been playing around $(document).ready, no luck far.
many thanks!
update:
the result of code depends (on what, don't know): alert comes first, comes second...
your code right.
from jquery documentation:
callback function if "complete" callback provided, executed after post-processing , html insertion has been performed. callback fired once each element in jquery collection, , set each dom element in turn.
Comments
Post a Comment