0
假設我有一個容器<div id="container"></div>
,我想用一個$.post
響應填充動態生成的元素。突然間,由於某種原因,我想終止處理那個響應並有另一個$.post
調用,而我只想處理稍後調用的結果。在jQuery中終止函數
截至目前,沒有先前的呼叫終止後,一旦前一結束第二個呼叫的處理將只開始..
所以..容器我想填補:
<div id="container"></container>
我的jQuery在一個非常基本的方法:
$(function() {
$.post("some.php", { val1:val1, val2:val2, .. }, function(response){
// processing of the response: append pre formatted elements to the container
});
});
和上面的函數是一個,我想與任何結果處理結束再打電話以前的電話。
我希望至少這是有道理的,如果是這樣,請幫助我! :) 謝謝!
的可能重複調用
.abort()
(http://stackoverflow.com/questions/3312960/jquery- abort-ajax-request-before-sending-another) – undefined 2013-05-01 22:45:47http://stackoverflow.com/questions/446594/abort-ajax-requests-using-jquery – undefined 2013-05-01 22:46:26