Why don't synchronous ajax calls in jquery support timeout?

前端 未结 3 1105
被撕碎了的回忆
被撕碎了的回忆 2021-01-06 06:21

I was reading here that synchronous ajax calls in jquery don\'t time out.

Is this a technical limitation, or just something the authors didn\'t feel like supporting

3条回答
  •  孤城傲影
    2021-01-06 06:53

    A synchronous AJAX call blocks until the request has been finished. Implementing a timeout is not possible for technical reasons, because the AJAX call would have to be executed later.

    If an AJAX call is executed later, the function somehow has to implement a blocking feature, to stop the code from running further after the AJAX call, and execute it again after a timeout - not possible.

提交回复
热议问题