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 7656959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:54:10+00:00 2026-05-31T12:54:10+00:00

here is the code $(function() { $(input[type=button]).click( function(evt) { if( !window.sayHi ) { evt.target.disabled

  • 0

here is the code

$(function() {
    $("input[type=button]").click(            
            function(evt) {                        
                if( !window.sayHi ) {
                    evt.target.disabled = "disabled";
                    $.getScript("hi.js", function() {
                        sayHi($("input[type=text").val());
                        evt.target.disabled = "";
                    });
                }
                else{
                    sayHi( $("input[type=text").val() );
                }
            });
});

what will happen if i click on button repeatedly then $.getScript() will download hi.js file repeatedly or only first time?

$.getScript() check the js file exist in client machine or not….if not then it download only? please discuss. thanks

i got the detail about getScript() function. here i am giving the code where i stuck for few lines.

jQuery.cachedScript = function(url, options) {

// allow user to set any option except for dataType, cache, and url
options = $.extend(options || {}, {
dataType: "script",
cache: true,
url: url
});

// Use $.ajax() since it is more flexible than $.getScript
// Return the jqXHR object so we can chain callbacks
return jQuery.ajax(options);
};

// Usage
$.cachedScript("ajax/test.js").done(function(script, textStatus) {
console.log( textStatus );
});

1) cachedScript() function need two argument but only one is sending at the time of calling….why?

2) from where done() function come here?

please explain the above two points

  • 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-31T12:54:11+00:00Added an answer on May 31, 2026 at 12:54 pm

    jQuery appends the current Unix epoch as a GET param so it will be downloaded for each click event (provided they don’t occur in the same millisecond) :P.

    Be 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().

    Source.

    It’d be good form to set a flag and test for it or look for a variable that is defined in the new script. Then write a condition based on that.

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

Sidebar

Related Questions

Here is my jQuery code: <script type=text/javascript> //<!-- $(document).ready(function() { $('input[type=submit]').click(function() { $.ajax({ type:
Trying to truncate some code here and running into a problem: <script type=text/javascript> $(function()
Here is a code: <input type=button id=array[1] value=Value1 /> <input type=button id=array[2] value=Value2 />
Here is my code: $('.button').click(function() { $(this).addClass('clicked'); $('.button').not(this).removeClass('clicked') .addClass('not_clicked'); $('#tool_window,#wrapper').not('#work_area').not('.button').addClass('outside'); }); $('.outside').click(function() { $('.clicked').removeClass('clicked');
Here is the code: $('#sousmenu a').click (function (){ startSlideshow(<?php echo json_encode(glob(photos- .$_GET[folder]. /*.jpg));?>); return
Here is my code: var showNo = 1; window.setInterval(function() { console.log(showNo); if(showNo === 1)
I have this simple code here, nothing too advanced. $(input#send).submit(function(event){ event.preventDefault(); $.ajax({ type: 'POST',
Here is my code: function pauseSound() { var pauseSound = document.getElementById(backgroundMusic); pauseSound.pause(); } I
I am completely stumped. Here is my php (CodeIgniter) code: function mod() { $uid
p2 = setInterval(function () { clearInterval(p2); some code here; }, waitTime) I need to

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.