" /> " /> "/>

Cant send Ajax to localhost in Apache Cordova. Get ajax error status 0

368 Views Asked by At

White-list already installed. CORS on server enabled. use in 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:

 $.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}`);
           }

});

meta in index.html:

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

After sending req I get the message: 0 error

0

There are 0 best solutions below