[英]Flipswitch updating mysql using jquery-mobile
I'm trying to utilize the JQM Flipswitch but I'm encountering some problems. 我正在尝试利用JQM Flipswitch,但遇到一些问题。 My goal: when the flipswitch is turned on or off → java notices → php → mysql
我的目标:当翻盖开关打开或关闭时→Java通知→PHP→MySQL
This code sort-of works but there are two issues: 1) Always returns OFF 2) Doesn't update 此代码排序有效,但是有两个问题:1)始终返回OFF 2)不更新
Any help would be appreciated 任何帮助,将不胜感激
HTML HTML
<fieldset>
<div data-role="fieldcontain">
<span id="alarm_box">
<label for="alarm">Alarm:</label>
<input type="checkbox" id="alarm" data-role="flipswitch">
<div id="alarm_n"></div>
</span>
</div>
</fieldset>
JAVA/AJAX JAVA / AJAX
$('#alarm_box').on('click', function () {
var checkStatus = this.checked ? 'ON' : 'OFF';
$.post("main_send.php", {
"alarm": checkStatus
},
function (data) {
$('#alarm_n').html(data);
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.