I want to call two functions automatically when the page loads. How to do it with jQuery?
Suppose my function is getData();
How do I开发者_JAVA百科 initiate this via jQuery?
$(function(){
getData();
});
See Introducing $(document).ready()
$(function()
is a shorthand for
$(document).ready(function()
JQuery way
$(function(){
getData1();//first function
getData2();//second function
});
$(document).ready(function(){
getData1();
getData2();
});
javascript way
精彩评论