I am facing an issue with a global function that does not seem to work properly in the PhoneGap Desktop app or Chrome Mobile on Android. Surprisingly, it works perfectly fine only in the Chrome PC version. The function is called using an onClick event, and it involves a switch checkbox SVG element with the ID #suich
.
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:');
}
});
};