The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Delay function call

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #242362
    Cory Kelly


    I have functions in a file that is being loaded first, that is calling other functions that exist on a file that is being loaded after. I am getting an error when theses functions are loaded that reads “Is not a function” and rightfully so. My question, is there a way to delay said functions to wait till the other file is loaded before calling?

    I was going to use the below, however how do you name this function?

    $.getScript("manualEntryCalculations.js", function(){

    Is there a better way, Whatever the solution I need to be able to name the function what my existing function is called so as to not create other issues.



    Do you have a link or a pen to provide your code?

    There are multiple ways to do what you’re asking. Do you want an event handler?

    From what I understand, .$getScript can use a callback (which looks to be what you’re doing); so you can use just a callback function. instead. A callback function can be set to run after the other scripts have completely loaded.

    If you want to stick with the $.getScript, you can try this:

    $.getScript("manualEntryCalculations.js').done(function () {
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.