use*_*153 6 javascript ajax jquery timeago
我无法了解页面中的脚本是如何加载的.我有依赖于其他脚本的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.
Run Code Online (Sandbox Code Playgroud)
在document ready我正在初始化timeago.但这不适合我.在控制台中,浏览器显示timeago无法正常运行.我想要的是确保在任何其他脚本运行之前已经加载了timeago.我的脚本还包含多个依赖于timeago的Ajax调用.
HTML 中脚本标签的顺序基本上决定了脚本加载的顺序。所以您已经正确设置了。
有几点可以帮助您调试问题:
根据下面的评论,浏览器似乎没有加载该文件,您需要能够使用 Chrome 开发人员工具来调试此类内容。