Telecommunications Cordoba Ajax requests 404 (not found) Error

My version of cordova 5.0.0

I get 404 error for all ajax request created when deploying the application on the device. It works fine in a web browser, but one application doesn’t work when deployed to a device.

I tried to add the following to solve the problem, but that did not help.

Config.xml

<access origin="*" /> 

AndriodManiest.xml

 <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 

I also added the following to my index.html file, but that didn't matter either.

 <script> $.support.cors=true; </script> 

Does anyone have another trick to solve this problem? This seems to be a fairly common phone issue, but the fixes above worked on the older version of phonegap / cordova, but they didn't work on my case.

Any help would be great.

+49
jquery ajax cordova
May 05 '15 at 8:59
source share
4 answers

I had the same problem and I had to install the cordova-plugin-whitelist plugin

 cordova plugin add cordova-plugin-whitelist 

Credit goes to this stackoverflow article - Ajax command to request URL no longer works

+99
May 06 '15 at 2:17
source share

In fact, it should add a white scroll plugin:

 cordova plugin add cordova-plugin-whitelist 

or in config.xml:

 <plugin name="cordova-plugin-whitelist" spec="1" /> 

but if you use the online call service, the syntax is different. You should add the following line to your config.xml file:

 <gap:plugin name="cordova-plugin-whitelist" source="npm" /> 

and allow cross-domain requests:

 <access origin="*" /> <allow-intent href="*" /> <allow-navigation href="*" /> 

This is not recommended because a wildcard is used everywhere and everything is allowed. But this is great for your tests.

+15
Oct 12 '15 at 10:01
source share

It worked for me. The only difference in my config.xml I had to put in node for it to take effect.

My example is below:

 <platform name="android"> <allow-intent href="market:*" /> <access origin="*" /> <allow-intent href="*" /> <allow-navigation href="*" /> </platform> 
+1
Jun 30 '16 at 19:04
source share

Phone Mail User. Adding this line to config.xml is the solution for me:

 <gap:plugin name="cordova-plugin-whitelist" source="npm" /> 
0
05 Oct '17 at 13:00
source share



All Articles