How to make jQuery functions sequential -


i have following code:

$(document).ready(function() {   loadstuff(someurl, someid);   showstuff('foo'); }); 

showstuff() relies on content generated loadstuff() seems if showstuff() jumping gun before said content available. how can force them run sequentially?

update: yes, there ajax calls in loadstuff unfortunately they're jsonp can't called synchronously.

rewrite as:

$(document).ready(function() {   loadstuff(someurl, someid, function() { showstuff('foo'); }); }); 

where third parameter of loadstuff callback call after content loaded


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -