10 Replies Latest reply on Nov 13, 2017 7:47 AM by laryk23

    JQuery Ajax Crossdomain request not working

    sne_paul Level 1

      Hi,

      I am using HTML5 + CSS + JQuery Mobile for Android app, below are my script :

       

      Not Working in Mobile after making APK ( apk, I am build it from http://build.phonegap.com upload the zip file ), but in Mobile browser data is coming.

       

      My Ajax Request :

      $.ajax({

        type: "GET",

        url: "http://192.168.1.103/DataCleaningApp/app-data.cfm",

        crossDomain: true,

        cache: false,

        success: function(result){

        var result=$.parseJSON(result);

        $.each(result, function(i, field){

        $("#output").append("Title: "+ field.title + " duration: "+field.duration +" Price:"+field.price+"<br/>");

        });

        },

        error: function(e) {

        alert('Error: ' + e.message);

          }

        });

       

      setting.xml :

       

      <?xml version="1.0" encoding="UTF-8" ?>

      <!-- Android -->

      <widget id="io.cordova.hellocordova"

        version="0.0.1"

        android-versionCode="1"

        xmlns="http://www.w3.org/ns/widgets"

        xmlns:cdv="http://cordova.apache.org/ns/1.0">

        <name>Customer Info</name>

        <description>

           Customer Info Gathering.

        </description>

        <author href="https://build.phonegap.com" email="snehendu.paul@gmail.com">

            Snehendu Paul

        </author>

       

        <content src="index.html" />

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

        <access origin="*" />

        <allow-intent href="http://*/*" />

        <allow-intent href="https://*/*" />

        <allow-intent href="tel:*" />

        <allow-intent href="sms:*" />

        <allow-intent href="mailto:*" />

        <allow-intent href="geo:*" />

        <allow-navigation href="http://192.168.1.103/DataCleaningApp/*" />

      </widget>

       

      Please help me.