Answer the question
In order to leave comments, you need to log in
How to set the maximum time to wait for a response from the server?
I am making an ajax request to the server via fetch, I need to specify the maximum timeout, how can I do this?
Answer the question
In order to leave comments, you need to log in
fetch doesn't have a method to stop/cancel the request, so no way. Use the good old XMLHttpRequest it has an abort() method which can be called by setting the setTimeout timer. And if successful, the timer is simply deleted and abort does not work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question