【发布时间】:2016-02-10 08:20:44
【问题描述】:
我有这个 GLOBAL 函数,它在 Android 的 Phonegap 桌面应用程序或 Chrome Mobile 中不起作用,它只在 Chrome PC 版本中起作用......我用 onClick 事件调用这个函数,#suich 是一个开关复选框 SVG
function setPush() {
var nick_ = window.localStorage.getItem("username");
var notify = window.localStorage.getItem("option");
$.ajax({
type: "POST",
url: "push_set.php",
data: ({
nick: nick_,
opcion: notify
}),
cache: false,
dataType: "json",
success: function(data) {
if (data.status == 'success') {
if (notify == 1) {
myApp.alert('Notifications disabled', 'Notice:');
$('#suich').prop('checked', false);
} else {
myApp.alert('Notifications enabled', 'Notice:');
$('#suich').prop('checked', true);
}
} else if (data.status == 'error')
alert('Connection problems', 'Warning:');
}
});
};
【问题讨论】:
-
你能发布完整的 HTML 页面吗...
标签: javascript android ajax cordova