上山打老虎 发表于 2021-7-21 15:52:44

jQuery.retryAjax

jQuery.retryAjax
Overload method for $.ajax that provides the ability to try the request over if it fails the first time.
https://github.com/mberkom/jQuery.retryAjax
jQuery.retryAjax
Overload method for $.ajax that provides the ability to automatically try the request over if it fails the first time.

Usage

<script type="text/javascript" src="dist/jquery.retryAjax.min.js"></script>
<script type="text/javascript">
    // Implments everything in $.ajax
    // Overrides complete method, so be sure not to use that...
    $.retryAjax({
      url: DESTINATION,
      timeout: 5000,
      retryLimit: 1,
      success: function() {
            alert("It worked!");
      },
      error: function() {
            // fires after the last try is unsuccessful
      }
    });
</script>

·


文档来源:51CTO技术博客https://blog.51cto.com/rongfengliang/3119928
页: [1]
查看完整版本: jQuery.retryAjax