Javascript ajax call on page onload

后端 未结 4 606
庸人自扰
庸人自扰 2020-12-08 20:18

I wish a page to fully load before issuing an ajax call to update database. I can call a javascript function in the body onload event so the page is fully loaded, but I\'m n

4条回答
  •  清歌不尽
    2020-12-08 21:01

    You can use jQuery to do that for you.

     $(document).ready(function() {
       // put Ajax here.
     });
    

    Check it here:

    http://docs.jquery.com/Tutorials:Introducing_%24%28document%29.ready%28%29

提交回复
热议问题