Не могу отправить Ajax на localhost в Apache Cordova. Получить ajax статус ошибки 0 - PullRequest
0 голосов
/ 11 июля 2019

Белый список уже установлен. CORS на сервере включен. использовать в config.xml:

<plugin name="cordova-plugin-whitelist" spec="1" />
<platform name="android">
    <allow-intent href="market:*" />
    <access origin="*" />
    <allow-intent href="*" />
    <allow-navigation href="*" />
    <access launch-external="yes" origin="*" />
</platform>

Аякс:

 $.ajax({        
    url : "http://127.0.0.1",
    type : "POST",
    data : {},
    crossDomain: true,
    dataType: 'json',
    success : formSuccessAuth,
    error: function(xhr, status, error) {
              alert(`${xhr.status} ${status} ${error}`);
           }

});

мета в index.html:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

После отправки запроса я получаю сообщение: 0 error

...