1. <small id='v5lA4'></small><noframes id='v5lA4'>

        <bdo id='v5lA4'></bdo><ul id='v5lA4'></ul>
        <i id='v5lA4'><tr id='v5lA4'><dt id='v5lA4'><q id='v5lA4'><span id='v5lA4'><b id='v5lA4'><form id='v5lA4'><ins id='v5lA4'></ins><ul id='v5lA4'></ul><sub id='v5lA4'></sub></form><legend id='v5lA4'></legend><bdo id='v5lA4'><pre id='v5lA4'><center id='v5lA4'></center></pre></bdo></b><th id='v5lA4'></th></span></q></dt></tr></i><div id='v5lA4'><tfoot id='v5lA4'></tfoot><dl id='v5lA4'><fieldset id='v5lA4'></fieldset></dl></div>

      1. <legend id='v5lA4'><style id='v5lA4'><dir id='v5lA4'><q id='v5lA4'></q></dir></style></legend>
        <tfoot id='v5lA4'></tfoot>
      2. 获取最新的 ajax 请求并中止其他请求

        Get latest ajax request and abort others(获取最新的 ajax 请求并中止其他请求)

        <i id='FqZVH'><tr id='FqZVH'><dt id='FqZVH'><q id='FqZVH'><span id='FqZVH'><b id='FqZVH'><form id='FqZVH'><ins id='FqZVH'></ins><ul id='FqZVH'></ul><sub id='FqZVH'></sub></form><legend id='FqZVH'></legend><bdo id='FqZVH'><pre id='FqZVH'><center id='FqZVH'></center></pre></bdo></b><th id='FqZVH'></th></span></q></dt></tr></i><div id='FqZVH'><tfoot id='FqZVH'></tfoot><dl id='FqZVH'><fieldset id='FqZVH'></fieldset></dl></div>
          <tbody id='FqZVH'></tbody>
        <tfoot id='FqZVH'></tfoot>
          • <bdo id='FqZVH'></bdo><ul id='FqZVH'></ul>

            <legend id='FqZVH'><style id='FqZVH'><dir id='FqZVH'><q id='FqZVH'></q></dir></style></legend>

                  <small id='FqZVH'></small><noframes id='FqZVH'>

                • 本文介绍了获取最新的 ajax 请求并中止其他请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在寻找,这个问题看起来很简单,但找不到答案.我有多个请求调用不同的 url.但是对于每个 url,我只想要一次结果,并且它必须是被调用的同一个 url 中的最后一个.我现在的问题是如何只获得最后一个?"我看了这个好像3岁了:

                  I have been searching and this problem seems simple but cannot find answer. I have multiple request calling different url. But for each url, I only want the result once and it must be the last one in the same url being called. My issue now is "how to get the last one only?" I looked at this and it seems to be 3 years old:

                  http://plugins.jquery.com/project/ajaxqueue

                  还有其他方法可以很好地干净地做到这一点吗?如果有这样的东西就完美了:

                  Any other way to do this nicely and cleanly? If there is something like this, it would be perfect:

                  queue: "getuserprofile",
                  cancelExisting: true
                  

                  (getuserprofile队列中现有的ajax将被取消)

                  (where the existing ajax in getuserprofile queue will be canceled)

                  谢谢

                  推荐答案

                  这个解释 如何使用 jQuery 进行 ajax 调用以及如何中止它.您需要做的就是创建一个存储每个请求的数组.然后,您可以在添加新请求的同时取消之前的请求.

                  This explains how to use jQuery to do an ajax call and how to abort it. All you need to do is create an array that stores each request. You could then cancel the previous request while adding the new one.

                  ajaxRequests = new Array();
                  
                  queueRequest = function() {
                      if(ajaxRequests[ajaxRequests.length - 1]) {
                          ajaxRequests[ajaxRequests.length - 1].abort();
                      }
                  
                      ajaxRequests[ajaxRequests.length] = //Insert New jQuery AJAX call here.
                  }
                  

                  这篇关于获取最新的 ajax 请求并中止其他请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)

                  1. <legend id='2K1nR'><style id='2K1nR'><dir id='2K1nR'><q id='2K1nR'></q></dir></style></legend>

                      <tbody id='2K1nR'></tbody>

                  2. <small id='2K1nR'></small><noframes id='2K1nR'>

                    <tfoot id='2K1nR'></tfoot>

                        <bdo id='2K1nR'></bdo><ul id='2K1nR'></ul>
                          <i id='2K1nR'><tr id='2K1nR'><dt id='2K1nR'><q id='2K1nR'><span id='2K1nR'><b id='2K1nR'><form id='2K1nR'><ins id='2K1nR'></ins><ul id='2K1nR'></ul><sub id='2K1nR'></sub></form><legend id='2K1nR'></legend><bdo id='2K1nR'><pre id='2K1nR'><center id='2K1nR'></center></pre></bdo></b><th id='2K1nR'></th></span></q></dt></tr></i><div id='2K1nR'><tfoot id='2K1nR'></tfoot><dl id='2K1nR'><fieldset id='2K1nR'></fieldset></dl></div>