Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7073347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:55:07+00:00 2026-05-28T05:55:07+00:00

I use getScript to load dynamically my plugin: $.getScript(‘js/code.photoswipe.jquery-3.0.4.min.js’, function () { //do magic

  • 0

I use getScript to load dynamically my plugin:

$.getScript('js/code.photoswipe.jquery-3.0.4.min.js', function () {
   //do magic
});
  1. How do I disable caching busting?
    At the moment it generates numbers at the end: js/code.photoswipe.jquery-3.0.4.min.js?_=1326992601415
    I saw this, but not sure how to use it in my case:

    $.getScript = function (url, callback, cache) {
       $.ajax({
          type: "GET",
          url: url,
          success: callback,
          dataType: "script",
          cache: cache
       });
    };
    
  2. If I call $.getScript multiple times adding the same js file, does it do request each time to get that file? If so, is there a way to check if we already imported that script, so we could avoid calling getScript again for the same file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:55:08+00:00Added an answer on May 28, 2026 at 5:55 am

    Your browser will cache the url accordingly already.. So you don’t have to worry about caching.

    If however you want to bust the cache simply add a random string to the url like so:

    $.getScript('js/code.photoswipe.jquery-3.0.4.min.js?' + Math.random(), function () {
            //do magic
    });
    

    ?' + Math.random() will allow for a random number to append to your js file so caching is broken with each request for the file (as it randomly generates a number)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to dynamically load a jQuery plugin by calling getScript - but
jQuery's getScript function doesn't seem to support an error callback function. I can't use
Is it better (in any way) to use jQuery's getScript to load the external
$.getScript('ajax/test.js', function() { alert('Load was performed.'); }); .. like the above code which loads
I try to dynamically load many scripts in my page function loadAdditionalScripts() { $.when(
I want to use jQuery to asynchronously load CSS for a document. I found
core.js: var core = { all:{}, load: function(jsUrl) { $.ajaxStup({async, false}); $.getScript(jsUrl); }, init:
So I'm trying to load a javascript remotely using jquery's $.getScript, but I'm puzzled
this is my demo code : <body onload=initialize()> <script> function initialize(){ var d='adddd' $.getScript('other.js',
Use case: user clicks the link on a webpage - boom! load of files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.