Why call $.getScript instead of using the – cdhowie Dec 08 '10 at 22:24

  • 1
    Since jQuery 1.2 you can use $.getScript to dynamically load cross-domain scripts. Source: http://blog.jquery.com/2007/09/10/jquery-1-2-released/ – Grzegorz Luczywo Jun 23 '14 at 17:02
  • 0

    No need to do that..

    You do that if you want to load the script dynamically (when needed, and not from the beginning)

    Gabriele Petrioli
    • 191,379
    • 34
    • 261
    • 317
    0

    The script might depend on jQuery, so it would be a way to prevent the browser trying to load it if it hasn't loaded jQuery.

    There are a number of reasons that jQuery might not load, from a simple network failure to a CDN not being whitelisted by a NoScript user.

    Quentin
    • 914,110
    • 126
    • 1,211
    • 1,335
    0

    maybe to control when a script is loaded? On a javascript heavy page, it may be worth waiting to load some things that are non essential until after essential things are loaded.

    Matt Briggs
    • 41,224
    • 16
    • 95
    • 126