I have this GLOBAL function that is not working in Phonegap Desktop app or Chrome Mobile at Android, it works only in Chrome PC version...i call this function with an onClick event, #suich
is a switch checkbox 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:');
}
});
};
try to put full url instead of
url: "push_set.php"
like
url: "www.yourdomain.com/push_set.php"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.