我正在尝试从Kendoui复选框中获取值,但迄今为止没有成功。
<input type="checkbox" id="telephonyeq1" name="telephonychk[]" class="k-checkbox telephonycb">
剧本
<script>
if($('#telephonyeq1').is(":checked"))
{
var telephonycb = "true"
}
else {
var telephonycb = "false"
}
</script>
当我通过AJAX发布数据时,我总是收到“False”值,即使它被选中或未选中。
Telephony: false
还有Ajax
$("#save").click(function() {
$.ajax({
url: "/test",
method: "post",
data: {
.....
"telephonycb": telephonycb,
"internetcb": internetcb,
"_token": "{{ csrf_token() }}"
},
success: function(data) {
if($.isEmptyObject(data.error)){
printSuccessMsg(data.success);
} else{
printErrorMsg(data.error);
}
}
});
});
function printErrorMsg (msg) {
......
}
function printSuccessMsg (msg) {
$(".print-error-msg").find("ul").html('');
$(".print-error-msg").css('display','none');
$(".print-success-msg").css('display','block');
$("h5 span").html(
'<br /><h5><strong>Incident Description</strong>
.......
'</code><br /><h5><strong>Impact on Services</strong></h5>Telephony: <code>' + telephonycb + '</code> Service Issues <code>' + telephony.value() + '</code> - Affected Users: <code>' + telephonyaffected.value() +
'</code><br />Internet: <code>' + internetcb + '</code> Service Issues <code>' + internet.value() + '</code> - Affected Users: <code>' + internetaffected.value() +
......
);
}
});
</script>