Use of javascript/jquery cdn or calling another js file

Discussion in 'CRM / Helpdesk / App Integration' started by akmag47, Feb 24, 2015.

Thread Status:
Not open for further replies.
  1. akmag47

    Joined:
    Feb 21, 2015
    Messages:
    15
    Likes Received:
    0
    Trying to see if there is a possibility to use a jquery/javascript cdn or another external javascript file within the javascript file defined in the 3CX VAD.

    I have some ideas in mind that I would like to implement and it would make use of this concepts but so far, what I have only been able to do is create several functions within the javascript file in the libraries folder and use them.

    An example doing this:

    Calling this on the javascript file:
    <script src="https://cdnjs.cloudflare.com/ajax/libs/6px/1.0.3/6px.min.js">
    And then try to use the functions defined here would not allow the 3cx application to work as intended.

    I've also tried (in test.js):

    function createEl()
    {
    var oJs = document.createElement('script');
    oJs.setAttribute('type','text/javascript');
    oJs.setAttribute('src','test1.js');
    document.getElementsByTagName('head')[0].appendChild(oJs);
    var response = call();
    return response;
    }

    Then on test1.js (resides on the same directory):

    function call()
    {
    var voice = "ha ha ha";
    return voice;
    }

    But it doesnt retrieve the call function and only loops at the beginning of the call.

    Any thoughts?
     
  2. VAD_Support

    VAD_Support Active Member

    Joined:
    Aug 6, 2009
    Messages:
    690
    Likes Received:
    0
    Hi there,

    Please note that the application generated will not run in a standard browser. So for example calling:
    document.getElementsByTagName('head')[0].appendChild(oJs);

    will not work at all...

    You can't use jquery or load external javascript libraries from here, that will not work.

    If you need to do it, maybe you can create your own web service, and use jquery from there. From the VAD you just call the web service.

    Kind regards.
     
  3. akmag47

    Joined:
    Feb 21, 2015
    Messages:
    15
    Likes Received:
    0
    Ah, ok. While that is a setback, I think I can work around that. Thanks!
     
Thread Status:
Not open for further replies.