Search code examples
javascriptjquerygetscript

Is there a default timeout for jQuery`s getScript method?


I am using jQuery's getScript() method to load some third part js library, I am wondering whether there's a default time out value for this method. I don't really believe getScript will keep waiting until it gets a response, but I need to know how long before it quit and if that value is not ideal to me, is there a way to configure it? Maybe something like this?

$.ajaxSetup({
  cache: true
});

Solution

  • According to jQuery documentation

    This is a shorthand Ajax function, which is equivalent to:

    $.ajax({
      url: url,
      dataType: "script",
      success: success
    });
    

    So it uses the default timeout which you can override as usually you do for jQuery.ajax.