[英]Ajax POST works in Desktop but not in Phonegap App or Android
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 我有这个GLOBAL函数在Phonegap Desktop应用程序或Android的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:');
}
});
};
try to put full url instead of 尝试输入完整网址,而不是
url: "push_set.php"
like 喜欢
url: "www.yourdomain.com/push_set.php"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.