form.on('switch(switchTest)', function (data) {
console.log(data.othis.parents("tr").find("td").eq(1).text())
//id
var userId = data.othis.parents("tr").find("td").eq(1).text();
var x = this.checked ? true : false;
console.log(x)
//console.log(data.othis.text())
if (x) {
console.log("是,,,,,true")
data.value = ("1")
console.log(data.value)
} else {
console.log("否,,,,,true")
data.value = "2"
console.log(data.value)
}
$.ajax({
url: '/UserUpdateForDelServlet',
type: 'post',
data: {
"sfDel": data.value,
"userId": userId
},
dataType: "json",
success: function (res) {
console.log(res)
}
});
layer.msg('开关checked:' + (this.checked ? 'true' : 'false'), {
offset: '6px'
});
// layer.tips('温馨提示:请注意开关状态的文字可以随意定义,而不仅仅是ON|OFF', data.othis)
});
04-26
5515