Hasan Daghash
Hasan Daghash

Reputation: 1691

$.getScript() in JQuery how this method exactly work

I need to make sure that how $.getScript() JQuery method exactly work , is this method check for the script if it was loaded before load it agian or will load the external script each time I call the method.

I have tried to take a look on this method source

Upvotes: 1

Views: 57

Answers (1)

Arjun
Arjun

Reputation: 3803

From the very documentation you linked to:

By default, $.getScript() sets the cache setting to false. This appends a timestamped query parameter to the request URL to ensure that the browser downloads the script each time it is requested. You can override this feature by setting the cache property globally using $.ajaxSetup():

$.ajaxSetup({
  cache: true
});

Upvotes: 2

Related Questions