I can't get how the scripts in a page are loaded. I have jQuery plugins that depend on other scripts. I am using the timeago jQuery plugin. I have loaded this script in head in order:
我不知道页面中的脚本是如何加载的。我有依赖于其他脚本的jQuery插件。我使用的是timeago jQuery插件。我已经将这个脚本按顺序载入:
<script src="<?php echo base_url().'content/scripts/jqueryEngine/jquery.js' ?>" type="text/javascript"></script> //jquery library
<script src="<?php echo base_url().'content/scripts/timeago.js' ?>" type="text/javascript"></script> //timeago
<script src="<?php echo base_url().'content/scripts/myscript.js' ?>" type="text/javascript"></script> // Custom scripts that contains ajax.
And in document ready
I am initializing timeago. But this is not working for me. In the console, the browser shows timeago is not functioning. What I want is to ensure that timeago has already loaded before any other script runs. My scripts also contains multiple Ajax calls that rely on timeago.
在文档准备中,我正在初始化timeago。但这对我不起作用。在控制台,浏览器显示timeago没有工作。我要做的是确保timeago在运行其他脚本之前已经加载了。我的脚本还包含许多依赖于时间的Ajax调用。
1 个解决方案
#1
0
The order of the script tags in your HTML basically determines the order of your scripts loading. So you have that setup correctly already.
HTML中脚本标记的顺序基本上决定了脚本加载的顺序。你已经正确地设置好了。
A couple of points to help you debug your issue:
以下几点可以帮助您调试您的问题:
- Look at the developers console to see if time ago is actually loaded? or did you get a 404
- 看看开发者控制台,看看时间是否真的加载了?或者你得到404页面了吗
- Still in the developer console, are there any errors reported? these cause your applications to not run as expected.
- 仍然在开发人员控制台中,是否报告了任何错误?这将导致应用程序不能按预期运行。
Based on the comments below, it seems that the file is not being loaded by the browser, and you need to be able to debug things like this using the chrome developer tools.
根据下面的评论,似乎浏览器没有加载文件,您需要能够使用chrome developer工具调试类似的东西。
#1
0
The order of the script tags in your HTML basically determines the order of your scripts loading. So you have that setup correctly already.
HTML中脚本标记的顺序基本上决定了脚本加载的顺序。你已经正确地设置好了。
A couple of points to help you debug your issue:
以下几点可以帮助您调试您的问题:
- Look at the developers console to see if time ago is actually loaded? or did you get a 404
- 看看开发者控制台,看看时间是否真的加载了?或者你得到404页面了吗
- Still in the developer console, are there any errors reported? these cause your applications to not run as expected.
- 仍然在开发人员控制台中,是否报告了任何错误?这将导致应用程序不能按预期运行。
Based on the comments below, it seems that the file is not being loaded by the browser, and you need to be able to debug things like this using the chrome developer tools.
根据下面的评论,似乎浏览器没有加载文件,您需要能够使用chrome developer工具调试类似的东西。