Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Nice Sergey! So, you're using .get() to check if the file exists and .getScript() to check to see if it can be executed/loaded without errors?
    – jjwdesign
    Commented Nov 13, 2013 at 18:24
  • 2
    Yes. As I recall, this approach does have limitations: you won't be able to load many scripts in this way --- if I remember correctly, because of cross-domain scripting restrictions. Commented Nov 14, 2013 at 0:47
  • The problem with using jQuery (or another library) is that you need to first load that library. So how do you check if that library failed to load?
    – Pacerier
    Commented May 7, 2014 at 9:04
  • I've taken this approach as well, but I recommend using cache:true for the $.getScript call (this is off by default). This way, for most requests, it automatically uses the cached version for the getScript call (saving you latency) Commented Dec 10, 2014 at 16:32