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
});
0

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I just read through this similar question link, seems there is not a default time out value for the jQuery ajax, it depends on the browser itself, is this true?
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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.