我在Android应用程序(JS / CORDOVA)中遇到了AJAX问题。我的代码是这样的:
$.post("http://mydomain.com.br/getInfos.php" {
id: id
}, function(json) {
if (json == "success") {
alert("Success!");
} else {
alert("Error: " + json);
}
});
响应错误是:
{“readyState”:0,“responseText”:“”,“status”:0,“statusText”:“error”}
我的代码在Android 8或更低版本中工作正常。...
可能会发生什么?
您可以使用插件cordova plugin add cleartext
来使用不安全的来源或修改config.xml,并指定android:usesCleartextTraffic
作为此问题Android 8: Cleartext HTTP traffic not permitted,>