how to execute jquery code one by one?
I want first do “function 1”, when finish the job. then do “function 2″…
Thanks.
<script type="text/javascript">
jQuery(document).ready(function(){
$(document).ready(function(){
//function 2, jqeury.ajax
});
$(document).ready(function(){
//function 3, jqeury.json
});
$('#col').load("home.html");
//function 4, jqeury.load
});
});
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
//function 1, a jquery slider plungin
});
</script>
You don’t need so many document ready calls. One will suffice
If you mean you want to call each method after one has received the response from the AJAX calls you are making, put the code in the callback;
The docs
http://api.jquery.com/jQuery.get/
http://api.jquery.com/jQuery.getJSON/
http://api.jquery.com/load/