jquery:如何将其他 .js 文件包含到 .js 中 [英] jquery: how to include other .js-files into .js

查看:15
本文介绍了jquery:如何将其他 .js 文件包含到 .js 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何 jquery 插件(而不是 incldeMany)或简单的函数来按需包含 js 文件?

Is there any jquery plugin (instead of incldeMany) or simple function to include js-files on demand ?

例如:

$.include('myscript.js'); 

?

推荐答案

jQuery.getScript() 怎么样?它内置在 jQuery 中,工作方式如下:

How about jQuery.getScript()? It's built in to jQuery and works like so:

$.getScript('ajax/test.js', function() {
    alert('Load was performed.');
});

这篇关于jquery:如何将其他 .js 文件包含到 .js 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆