我必須根據複選框在mysql表中設置0和1,如果它是否檢查。 我正在使用jquery ajax函數, 但jquery函數下面沒有傳遞數據到php文件。請你糾正我的代碼。不能通過任何變量通過jquery ajax
$(document).ready(function(){
$("input.active").click(function() {
// store the values from the form checkbox box, then send via ajax below
var check_active = $(this).is(':checked') ? 1 : 0;
var check_id = $(this).attr('value');
$.ajax({
type: "GET",
url: "dynamicupdateicube.php",
data: {id: check_id, active: check_active}
success: function(){
alert("updated");
}
});
});
});
這將是很好,如果你能拯救我的生命。
語法錯誤的數據線和 後面的逗號:缺少','後'數據:{ID:check_id,活躍:check_active}' – Tushar
有一個語法錯誤,並確保你已經添加了一個jQuery庫 –
@nehaJ歡迎!在開發保持瀏覽器控制檯處於打開狀態時,請使用能夠首先檢測這些錯誤的_smart_編輯器,請使用[jslint](http://www.jslint.com/)或[jshint](http://jshint.com/ ) – Tushar