我想使用ajax將我的複選框的值發送到數據庫。通過在互聯網上進行一些搜索,我以某種方式設法得到了這一點。這是我一直在使用的。我需要對json2.stringify進行哪些更改才能正確發送我的值。如何通過ajax發送複選框值:true或false通過ajax
HTML:
<input type="checkbox" id="txtCategoryIsPaid" name="cateogryIsPaid" value="Paid">Yes<br>
的Javascript:
AddCategory: function() {
BusinessManagement.config.method = "AddBusinessCategory";
BusinessManagement.config.url = BusinessManagement.config.baseURL + BusinessManagement.config.method;
BusinessManagement.config.data = JSON2.stringify({
CategoryIsPaid: $('#txtCategoryIsPaid :checked').val(),
});
BusinessManagement.config.ajaxCallMode = 0;
BusinessManagement.ajaxCall(BusinessManagement.config);
'$( '#txtCategoryIsPaid')是( ':檢查')。' – Tushar