Javascript 复选框数据绑定是否返回两个值?
我正在尝试获取ID和复选框状态(我将CSS作为一个按钮) 按钮名称,如果激活Javascript 复选框数据绑定是否返回两个值?,javascript,ajax,Javascript,Ajax,我正在尝试获取ID和复选框状态(我将CSS作为一个按钮) 按钮名称,如果激活 <div class="onoffswitch"> <input type="checkbox" data-bind="checked: ioValue" class="onoffswitch-checkbox" id="io1"> <label class="onoffswitch-label" for="io1"> <span class="onoffswi
<div class="onoffswitch">
<input type="checkbox" data-bind="checked: ioValue" class="onoffswitch-checkbox" id="io1">
<label class="onoffswitch-label" for="io1">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
event.target.id应该给你“id”
self.ioEvent = function(data, event) {
console.log(1)
console.log(data)
console.log(data[0])
console.log(data[1])
$.ajax({
type: "GET",
dataType: "json",
data: {"io": data[0], "status": data[1]},
url: "/plugin/test/setIOcheckbox",
async: false
});
}