Is the callback on jQuery's getScript() unreliable or am I doing something wrong?

后端 未结 11 1241
Happy的楠姐
Happy的楠姐 2020-12-03 03:17

I\'m using the following bit of script to load another one:

$.getScript(\"CAGScript.js\", function () {
    try {
        CAGinit();
    } catch(err) {
              


        
11条回答
  •  有刺的猬
    2020-12-03 03:57

    My way is

    setTimeout(function(){ 
      $.getScript( "CAGScript.js");
      }, 
    2000);
    

    this same issue we face in angular also when we want to update data in $scope and it is solved by using $timeout in same manner in angular...

提交回复
热议问题