Kin*_*ton 6 javascript jquery bootstrap-dialog
我知道如何在HTML文件中包含CDN。
<!DOCTYPE html>
<html>
<head>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是我想做的是:
我想在我的JavaScript文件中包含CDN(如jquery)。
可能我要做的是不可能的。
实际上,我想从我的JavaScript文件中调用BootstrapDialog.Confirm。
因此,我想在js文件中包含BootstrapDialog所需的CDN。
然后,我可以调用BootstrapDialog.Confirm。
如果我的问题不合理,请原谅我,因为我是初学者。
小智 8
您可以使用Javascript完成:
var jQueryScript = document.createElement('script');
jQueryScript.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js');
document.head.appendChild(jQueryScript);
Run Code Online (Sandbox Code Playgroud)