简体   繁体   English

使用Dojo AMD加载程序加载jQuery问题

[英]Loading jQuery with Dojo AMD loader Issue

I am trying to load jQuery using Dojo AMD. 我正在尝试使用Dojo AMD加载jQuery。 which is working fine when I use Jquery CDN path Below the code. 当我在代码下面使用Jquery CDN路径时,这工作正常。

<script type="text/javascript"
src="WidgetDownloadTest/lib/dojo/dojo/dojo.js"
data-dojo-config="async: true, packages: [
{ name: 'jquery', location: 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1', main: 'jquery' }
]">
</script>

however if I change the jquery path to Local machine (absolute path) . 但是,如果我将jquery路径更改为Local machine(绝对路径)。 Jquery libaries(jquery-1.10.2.js,jquery-ui-1.10.4.custom.js,jquery-ui-1.10.4.custom.min.js) are placed in folders 'jquery/1.7.1' jQuery库(jquery-1.10.2.js,jquery-ui-1.10.4.custom.js,jquery-ui-1.10.4.custom.min.js)放在文件夹'jquery / 1.7.1'中

<script type="text/javascript"
src="WidgetDownloadTest/lib/dojo/dojo/dojo.js"
data-dojo-config="async: true, packages: [
{ name: 'jquery', location: 'jquery/1.7.1', main: 'jquery' }
]">
</script>

Please help me on this. 请帮我。 Thanks in advance. 提前致谢。

Pradeep 普拉迪普

Scripts mentioned in 'location' should be relative from the 'dojo.js' folder (in your case: WidgetDownloadTest/lib/dojo/dojo/dojo.js). “位置”中提到的脚本应相对于“ dojo.js”文件夹中的脚本(在您的情况下:WidgetDownloadTest / lib / dojo / dojo / dojo.js)。

So if for example the jquery libraries exist in 'WidgetDownloadTest/lib/jquery/1.7.1' then the 'location' parameter should be set to: 因此,例如,如果jquery库存在于“ WidgetDownloadTest / lib / jquery / 1.7.1”中,则应将“ location”参数设置为:

location:'../../jquery/1.7.1' 位置:” ../../的jquery / 1.7.1'

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

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