我想僅在第一次點擊時調用ajax以節省帶寬,數據量非常大。下面是我的代碼僅在第一次點擊時觸發Ajax
$('.id-list').click(function() {
$.ajax({
type: "POST",
url: "timesheet.php?action=idlist",
async: false,
success: function(rdata) {
$('.id-list').removeClass('id-list') //remove the class
}
})
})
檢查的元素,除去class="id-list"
,但是當我再次點擊它,它再次觸發Ajax調用,我不希望發生的事情。
有什麼辦法可以實現這個嗎? 謝謝。
偉大的思想.... – mplungjan 2012-07-15 06:35:26
@mplungjan謝謝! – genpet 2012-07-15 06:42:20
@Tats_innit謝謝! – genpet 2012-07-15 06:42:42