1 Reply Latest reply on Mar 11, 2018 9:15 AM by jcesarmobile_

    PhoneGap ios build Ajax not working


      Ajax call to login in to app not working in ios phonegap build but working good in Android.

      It was working fine earlier on both Android and ios but after creating new build it stoped working for ios. Then I installed old build and it also not working on ios.


      <?xml version='1.0' encoding='utf-8'?>


      <name>PFC</name> <description> A blank PhoneGap app. </description> <author email="support@phonegap.com" href="http://phonegap.com"> PhoneGap Team </author> <gap:plugin name="cordova-plugin-x-socialsharing" source="npm" /> <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" /> <gap:plugin  name="cordova-plugin-ionic-webview"  source="npm" /> <gap:plugin  name="cordova-plugin-ionic-keyboard"  source="npm" /> <content src="index.html" /> <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:*" />  <platform name="ios"> <preference name="target-device" value="universal" /> <preference name="prerendered-icon" value="true" /> <preference name="detect-data-types" value="true" /> <preference name="exit-on-suspend" value="true" /> <preference name="deployment-target" value="7.0" /> <preference name="fullscreen" value="true" /> <preference name="orientation" value="portrait" /> </platform> <platform name="android"> <preference name="fullscreen" value="true" /> <preference name="orientation" value="portrait" /> </platform>


      Ajax Call

      $("#login").click(function(){ var email=$("#email").val(); var password=$("#password").val(); var dataString="email="+email+"&password="+password+"&login="; if($.trim(email).length>0 & $.trim(password).length>0) { $.ajax({ type: "POST", url: "http://profitnesscoach.in/admin/login.php", data: dataString, crossDomain: true, cache: false, beforeSend: function(){ $("#login").html('Connecting...');}, success: function(data){ var JSONObject = JSON.parse(data); console.log(JSONObject);      // Dump all data of the Object in the console if(JSONObject["status"]=="success") { localStorage.login="true"; localStorage.email=email; localStorage.id=JSONObject["id"]; window.location.href = "home.html"; } else if(JSONObject["status"]=="failed") { $("#error").html('<div class="alert alert-danger"><strong>Ooops!</strong> Something went wrong.</div>') $("#login").html('Login'); } else if(JSONObject["status"]=="wrong") { $("#error").html('<div class="alert alert-danger"><strong>Ooops!</strong> Invalid Email or Password.</div>') $("#login").html('Login'); } } }); }return false; });