readyState“:0,”状态“:0,” statusText“:”错误“,同时通过AjaxCall调用api实现android

使用ajax调用l击中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();
        }

})

请允许我帮助克服这个问题

hexar 回答:readyState“:0,”状态“:0,” statusText“:”错误“,同时通过AjaxCall调用api实现android

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

// 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.

from this link I found my answer 那个适用于网络的代码也适用于Cordova Android应用程序

本文链接:https://www.f2er.com/3154225.html

大家都在问