【问题标题】:readyState":0,"status":0,"statusText":"error" while Call api through AjaxCall Realsed Apk androidreadyState":0,"status":0,"statusText":"error" while Call api through AjaxCall Realsed Apk android
【发布时间】:2019-11-06 07:33:09
【问题描述】:

使用 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();
        }

})

请让我帮助解决这个问题

【问题讨论】:

  • 请检查您的后端是否有错误。
  • 错误是什么
  • 谁能告诉我原因

标签: android ajax cordova


【解决方案1】:

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

// 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 webwiew 它也适用于 Cordova Android 应用程序

【讨论】:

    猜你喜欢
    • 2018-12-24
    • 2014-12-17
    • 2011-10-24
    • 1970-01-01
    • 2013-10-24
    • 1970-01-01
    • 2020-11-26
    • 2012-12-30
    • 1970-01-01
    相关资源
    最近更新 更多