title: Phonegap Ajax request not executing
body: <p>I have an Android app that I have been building on phoengap. I upgraded to the newest version on phoengap build:</p>
  
  <pre><code>&lt;preference name="phonegap-version" value="cli-5.2.0" /&gt;
  </code></pre>
  
  <p>And my config looks like this:</p>
  
  <pre><code>&lt;widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" id="com.beerportfolio.beerportfoliopro" version="5.2.1"&gt;
  
      &lt;preference name="phonegap-version" value="cli-5.2.0" /&gt;
  
      &lt;name&gt;Beer Portfolio&lt;/name&gt;
      &lt;description&gt;Know Your Beer&lt;/description&gt;
      &lt;author href="http://www.beerportfolio.glass" email="mike@beerportfolio.glass"&gt;Mike&lt;/author&gt;
      &lt;content src="index.html" /&gt;
  
      &lt;preference name="permissions" value="none" /&gt;
      &lt;preference name="orientation" value="default" /&gt;
      &lt;preference name="target-device" value="universal" /&gt;
      &lt;preference name="fullscreen" value="false" /&gt;
      &lt;preference name="webviewbounce" value="false" /&gt;
      &lt;preference name="disallowOverscroll" value="true" /&gt;
      &lt;preference name="prerendered-icon" value="true" /&gt;
      &lt;preference name="stay-in-webview" value="false" /&gt;
      &lt;preference name="ios-statusbarstyle" value="black-opaque" /&gt;
      &lt;preference name="detect-data-types" value="true" /&gt;
      &lt;preference name="exit-on-suspend" value="false" /&gt;
      &lt;preference name="show-splash-screen-spinner" value="true" /&gt;
      &lt;preference name="auto-hide-splash-screen" value="true" /&gt;
      &lt;preference name="disable-cursor" value="false" /&gt;
      &lt;preference name="android-minSdkVersion" value="10" /&gt;
      &lt;preference name="android-targetSdkVersion" value="19" /&gt;
      &lt;preference name="android-installLocation" value="auto" /&gt;
  
      &lt;gap:plugin name="org.apache.cordova.camera" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.media-capture" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.console" source="npm" /&gt;
      &lt;gap:plugin name="org.apache.cordova.device" source="npm" /&gt;
      &lt;gap:plugin name="org.apache.cordova.device-motion" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.device-orientation" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.dialogs" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.file" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.file-transfer" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.geolocation" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.globalization" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.inappbrowser" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.media" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.network-information" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.splashscreen" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.vibration" source="npm"/&gt;
      &lt;icon src="icon.png" /&gt;
  
      &lt;gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-ldpi" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-mdpi" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-hdpi" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="android" gap:qualifier="port-xhdpi" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="blackberry" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="ios" width="320" height="480" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="ios" width="640" height="960" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="ios" width="640" height="1136" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="ios" width="768" height="1024" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="ios" width="1024" height="768" /&gt;
      &lt;gap:splash src="splash.png" gap:platform="winphone" /&gt;
      &lt;access origin="*" /&gt;
  
      &lt;gap:plugin name="com.phonegap.plugins.barcodescanner" source="npm" /&gt;
      &lt;gap:plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" source="npm" /&gt;
  
  
      &lt;!-- iPhone / iPod Touch  - lower 4s --&gt;
      &lt;icon src="icon-57.png" gap:platform="ios" width="57" height="57" /&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="114" height="114" /&gt;
      &lt;icon src="icon-72.png" gap:platform="ios" width="72" height="72" /&gt;
  
      &lt;!-- iPhone / iPod Touch - 5-5s --&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="60" height="60" /&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="120" height="120" /&gt;
      &lt;!-- iPhone6-6+ --&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="180" height="180" /&gt;
  
      &lt;!-- Settings Icon --&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="29" height="29" /&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="58" height="58" /&gt;
  
      &lt;!-- Spotlight Icon --&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="40" height="40" /&gt;
      &lt;icon src="icon.png" gap:platform="ios" width="80" height="80" /&gt;
  
      &lt;plugin name="cordova-plugin-whitelist" version="1" source="npm"/&gt;
  
      &lt;gap:plugin name="org.apache.cordova.device" version="0.2.3" source="npm"/&gt;
      &lt;gap:plugin name="org.apache.cordova.geolocation" source="npm"/&gt;
  
      &lt;feature name="http://api.phonegap.com/1.0/battery" /&gt;
      &lt;feature name="http://api.phonegap.com/1.0/camera" /&gt;
      &lt;feature name="http://api.phonegap.com/1.0/geolocation" /&gt;
      &lt;feature name="http://api.phonegap.com/1.0/network" /&gt;
      &lt;feature name="http://api.phonegap.com/1.0/notification" /&gt;
  
      &lt;allow-intent href="http://*/*" /&gt;
      &lt;allow-intent href="https://*/*" /&gt;
      &lt;allow-intent href="tel:*" /&gt;
      &lt;allow-intent href="mailto:*" /&gt;
      &lt;allow-intent href="geo:*" /&gt;
      &lt;platform name="android"&gt;
          &lt;allow-intent href="market:*" /&gt;
      &lt;/platform&gt;
      &lt;platform name="ios"&gt;
          &lt;allow-intent href="itms:*" /&gt;
          &lt;allow-intent href="itms-apps:*" /&gt;
      &lt;/platform&gt;
  &lt;/widget&gt;
  </code></pre>
  
  <p>When I try and execute a button to log in now, it never executes the ajax request. My html looks like this:</p>
  
  <pre><code>&lt;body&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="col s12 m7"&gt;
              &lt;div class="card"&gt;
                  &lt;div class="card-image"&gt;
                      &lt;img src="img/logo.png"&gt;
  
                  &lt;/div&gt;
                  &lt;div class="card-content"&gt;
                      &lt;div class="row"&gt;
                          &lt;form class="col s12"&gt;
                              &lt;div class="row"&gt;
                                  &lt;div class="input-field col s12"&gt;
                                      &lt;input id="email" type="text" class="validate"&gt;
                                      &lt;label for="email"&gt;Username&lt;/label&gt;
                                  &lt;/div&gt;
  
                                  &lt;div class="input-field col s12"&gt;
                                      &lt;input id="example" type="password" class="validate"&gt;
                                      &lt;label for="example"&gt;Password&lt;/label&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
  
                          &lt;/form&gt;
                          &lt;a id="login" class="waves-effect waves-light white-text btn orange"&gt;Login&lt;/a&gt;
  
                          &lt;a id="register" class="orange-text" style="float: right;" href="register.html"&gt;Register&lt;/a&gt;
  
  
  
                      &lt;/div&gt;
  
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;!--  Scripts--&gt;
  
      &lt;script src="js/jquery-2.1.4.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/init.js"&gt;&lt;/script&gt;
      &lt;script src="js/materialize.js"&gt;&lt;/script&gt;
      &lt;script src="js/home.js"&gt;&lt;/script&gt;
  
  
  
  &lt;/body&gt;
  </code></pre>
  
  <p>And my JS looks similar to this:</p>
  
  <pre><code>$(document).ready(function () {
  
  
      //check if user has already logged in once
      if (localStorage.getItem("userID") != null) {
          window.localStorage.setItem("userID", localStorage.getItem("userID"));
          window.location.replace("stats.html");
      }
  
      //if user has logged in go to stats page
  
      $("#login").click(function () {
          var u = $('#email').val();
          var p = $('#example').val();
          alert("test1");
          $.get("http://www.beerportfolio.glass/app_login2.php", {
                  ex1: example1,
                  ex2: example
              })
              .done(function (data) {
                  alert("test2");
                  if (data.status == "no") {
                      alert("test3");
                      mixpanel.track("Wrong User Name or password");
                      alert("Wrong username and password");
                  } else {
                      alert("test4");
                      mixpanel.track("User logged In");
                      //todo: store user name
                      mixpanel.identify(data.userID);
                      window.localStorage.setItem("userID", data.userID);
                      //redirect to statistics page
                      window.location.replace("stats.html");
                  }
              });
  
      });
  </code></pre>
  
  <p>When I execute in my browser on my desktop all works perfect. But when I execute after building with phonegap build, It only shows "test1" on execute which shows its not executing the ajax call. </p>
  
  <pre><code>});
  </code></pre>