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

后端 未结 11 1258
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:59

    Just wanted to offer some insight I have on this issue. The callback won't fire if there is an error in the code you are loading and (at least on Chrome with jQuery 1.7.1) the error will be swallowed. I discovered that I had a stray curly brace from autocomplete in the code I was loading and the callback function didn't fire. Intermittent behavior here could be caused by changing the loaded code between tests.

提交回复
热议问题