简体   繁体   中英

Call javascript function from another javascript webresource

There is one JavaScript web resource in CRM 2011 called new\\_/Script/genericJScript.js . Which contains some functions say, \\_retrieveRecord() and \\_Context() as below. And I need to call these methods from another JavaScript web resource called new\\_/Script/testJScript.js . How can we do this?

if (typeof (MyTest) == "undefined")
{
  MYTEST = { __namespace: true };
}

MYTEST.RESTCALL = {
  _Context: function () {
    ......
  },

  _retrieveRecord: function () {
    ......
  },
};

Assuming you include both resources on your form (I am assuming you are doing this from), the following should be valid:

webresource1.js

function HelloWorld() {
  alert('Hello, world!');
}

webresource2.js

//should alert 'Hello, World!' using the method from the other webresource
HelloWorld();

我认为答案就是调用MYTEST.RESTCALL._context()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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