2

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
});
isherwood
  • 58,414
  • 16
  • 114
  • 157
Spark8006
  • 635
  • 1
  • 7
  • 15

1 Answers1

0

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.

smnbbrv
  • 23,502
  • 9
  • 78
  • 109
  • I just read through this similar question [link](http://stackoverflow.com/questions/2507355/jquery-ajax-call-default-timeout-value), seems there is not a default time out value for the jQuery ajax, it depends on the browser itself, is this true? – Spark8006 Jun 05 '15 at 18:12
  • This really depends what is going on in `jQuery.ajax`. The big difference is that `getScript` function is not using `XMLHttpRequest`. It simply adds to your document some remote javascript. You can try to have a look into jQuery source code and find there the place where they implement the callback and the timeout for this case. This will give you the answer – smnbbrv Jun 06 '15 at 16:29