readyState":0,"status":0,"statusText":"error" 而通过 AjaxCall Realsed Apk android 调用 API



在使用ajax调用访问API时,我得到了低于错误的结果

readyState":0,"status":0,"statusText":"error"

Ajax调用方法:

var deviceId = FCM_Tocken_localStorage_GET();
//console.log(" Status ~~~~~~~~~~~~~~~~~~~~~~~~~~~>  " + deviceId);
//  alert(deviceId);
//debugger
var site = window.localStorage.getItem("site_id");
$.ajax({
url: baseURL + '/api/saveDeviceId?deviceId='+deviceId,
type: 'POST',
success: function(result) {
console.log("ResponseMessage----------------> " + JSON.stringify(result));
// alert(JSON.stringify(result));
if (result.status == "success") {
} else {
}
//      $(".modal").hide();
},
error: function(exception) {
alert(JSON.stringify(exception));
console.log('Exception:~~~~~~~~~~~~~~~~~~~~~> ' + exception);
//       $(".modal").hide();
}
})

请允许我帮助解决这个问题

我终于找到了答案,如下所述:

// A new webclient that ignore ssl errors
private class IgnoreSSLErrorWebViewClient extends WebViewClient {
// You can call the class anything
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) 
{
handler.proceed(); // When an error occurs, ignore and go on
}
}
The site has issues with SSL certificate verification. The default WebViewClient stops loading when there is an SSL verification error. This extension will instruct it to disregard the error and proceed.

从这个链接中,我找到了我的答案,一个适用于webwiew的适用于Cordova Android应用程序也适用于

最新更新