有沒有在這個Ajax調用中使用setTimeout的方法。這是我的代碼:setTimeout在jQuery中調用ajax
jQuery.ajax({
type : "POST",
url : dir+"all/money/myFile.php",
data : "page="+data.replace(/\&/g, '^'),
success : function(msg) {
var info = jQuery('.product_overview #allinfo').html();
var url = '<a href="http://www.mySite.com/openMe/letmeview.php?preview='+msg+'.html" target="_blank" class="check_link_preview" rel="'+msg+'.html">Check Preview</a>'; jQuery('.option_additional').next().find('textarea:first').text(info+url);
},
complete: function() {
jQuery('.add-to-cart button.btn-cart').delay(500).trigger('click');
}
});
我想要做的事在此之前阿賈克斯將被觸發,這就是爲什麼我會使用的setTimeout或東西會推遲這一行動。
我該怎麼做?
感謝提前:)
所以,如果你想使用它 - 你爲什麼不只是這樣做? ;-) – zerkms
@zerkms:我如何將它放在setTimeout函數中? – PinoyStackOverflower
像其他任何js代碼? – zerkms