0
我有一個按鈕,調用CFM頁面,它需要傳遞一個值,取決於用戶是否正在激活或停用數據庫中的記錄。我正在努力如何將活動/不活動值傳遞給jQuery。以下是我正在使用的代碼,它只能單向運行,即從活動狀態變爲非活動狀態。使用jquery根據按鈕值調用不同的URL
<script>
$(document).ready(function() {
$("#IsActive_1").click(function() {
//cache the status div
var status = $("#status");
//let the user know the record is being updated
status.html("<i>updating status...</i>");
$("#IsActive_1").html('activate');
//the status variable needs to be dynamic
$.get("updateStatus.cfm?status=inactive", {}, function(res,code) {
//show the result in plain HTML
status.html(res);
});
});
});
</script>
<button id="IsActive_1"><cfif IsActive>deactivate<cfelse>activate</cfif></button><div id="status"></div>
最後,我想改變按鈕上顯示激活文本/停用基於適當的條件(點擊取消,反之亦然後激活)。
TIA
用戶如何激活或取消激活記錄? – 2013-02-13 03:00:49