How to Use External Javascript Functions from within the Main.js in an App

4 댓글

  • SGL

    Hi Anyone,

    I still haven't solved this issue. From the main code, I want to be able to call functions that are defined in a separate javascript file.

    Help would definitely be appreciated.

    Thanks,

    SGL

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    Hey SGL,

    This isn't a Zendesk specific thing. You just need to order your JS files correctly in the html file so that the file you're wanting to call functions from is loaded first. Then the main.js file will be able to use it. Here's a small example, you'll see that the main.js file uses the function from the external.js file. 
     
    Hope this helps
    1
  • SGL

    Hi Eric,

    I thought that was what I had done, so when it failed I came to the erroneous conclusion that Zendesk was preventing it somehow. But I just tried it again, and it was successful -- so it was my mistake. Sorry to bug you about that.

    Thanks,

    SGL.

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    No worries SGL, happy to help. 
    0

댓글을 남기려면 로그인하세요.

Zendesk 제공