Does anyone know what the default jQuery ajax timeout value is?
What is jQuery's ajax default timeout value? [duplicate]
It seems it is undefined and left for the specific implementation in the browser: #2507855 #3395260 –
Delinquent
The default is 0
(technically it's undefined, but behaves as 0). This means no timeout in jQuery itself...if the browser has some timeout it's entirely possible you'll hit that.
Only when a timeout
option is specified does jQuery even call setTimeout()
.
my tests suggest erkmene, above, is actually right - the browser sets the timeout... –
Paraselene
@Paraselene - the line number in the source has changed in recent versions, but the answer above is still correct, note the
timeout > 0
check in jQuery itself: github.com/jquery/jquery/blob/master/src/ajax.js#L700 This isn't a question about raw setTimeout(myFunc,0);
, it's about jQuery's .ajax()
implementation when one's not specified. The default is still undefined
, but behaves like 0 in checks as you can see here. The default for jQuery (what the question was asking) is still effectively 0. –
Sinistrality Sure - I just think most people care more about what the effective timeout is.... So the best answer would say "by default the timeout is set by the browser" - followed by a technical explanation of whys + hows... –
Paraselene
Another thing to note is that jQuery AJAX timeout only works if the "async" setting is set to true, which is by default. –
Exult
© 2022 - 2024 — McMap. All rights reserved.