[英]How do I use an external Javascript library in CRM Dynamics?
I'll be doing some REST-ing and oData-ing so I got the executable from DataJS project . 我将进行一些REST-ing和oData-ing,因此我从DataJS project获得了可执行文件。 I've added the file
datajs-1.0.3.min.js
as a web resource and my own qwerty.js
as another one. 我添加了
datajs-1.0.3.min.js
文件作为网络资源,并添加了自己的qwerty.js
文件作为网络资源。 So, I've ended up with two web resources called: 因此,我最终得到了两个名为的网络资源:
The problem is now that when I execute the code snippet below from web resource 1 that I've found on their site , I get a crash telling me that: 现在的问题是,当我从在其站点上找到的Web资源1执行下面的代码片段时,发生崩溃,告诉我:
Field: window 栏位:视窗
Event: onload 事件:onload
Error: 'OData' is undefined 错误:“ OData”未定义
var shazoo = function () {
alert("Commenced...");
OData.read(
"http://services.odata.org/Northwind/Northwind.svc/Categories",
function (data) {
var html = "";
$.each(data.results, function (l) {
html += "<div>" + l.CategoryName + "</div>";
});
$(html).appendTo($("#target-element-id"));
}
);
alert("Completed.");
}
How can I refer from a method inside web resource 1 to a method inside web resource 2? 如何从Web资源1中的方法引用到Web资源2中的方法? I've found this discussion but it didn't give me much.
我已经找到了这个讨论,但是并没有给我太多好处。 I can't even tell if it's helpful if one understand what they're talking about.
我甚至不能告诉我们,如果如果一个人明白他们在说什么这是有帮助的。
EDIT 编辑
I've made some changes and went for trying if OData
is known to my method like this. 我已经进行了一些更改,然后尝试尝试这样的方法是否知道
OData
。
alert(OData);
Expecting a null
value, I was surprised to discover that it gave me {Object object} instead. 期望为
null
值,我惊讶地发现它给了我{Object object}。 So, I'm guessing the connection between web resources is made. 因此,我猜想Web资源之间已建立连接。 Is it so?
是这样吗? Also, still, how can I make the call to get me some oData formatted data?!
而且,仍然如何打电话给我一些oData格式的数据?
Have you added both libraries to the entity? 您是否已将两个库都添加到实体? It's not sufficient to add them only as web resources.
仅将它们添加为Web资源是不够的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.