简体   繁体   English

页面加载后执行jquery ajax

[英]Execute jquery ajax after page is loaded

To describe scenario that I want to make: 描述我想要制作的场景:

When user goes to stackoverflow.com the page is loaded fast. 当用户转到stackoverflow.com时,页面将快速加载。
And in the top right corner there are 2 menu items (inbox, achievements). 在右上角有2个菜单项(收件箱,成就)。

I have the same looking page. 我有相同的页面。

But as I need more time to load this items that cause that page load slower. 但是因为我需要更多时间来加载这些导致页面加载速度变慢的项目。
How can I execute JQuery ajax function to get those data after all data on page are already loaded. 如何在页面上的所有数据都已加载后执行JQuery ajax function来获取这些数据。

Basicaly: Load whole page > execute jquery and display results when you get them . 基本: 加载整个页面 > 执行jquery并在获得结果时显示结果

$(document).ready(function() { /* Ajax call */ });

或者,如果您希望使用更短的符号,则只需使用:

$(function() { /* Ajax call */ });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM