Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap app - JSONP Request happening in browser, but not on device (Android)
    text
    copied!<p>I am trying to make a JSONP call in my PhoneGap application. It works fine in my desktop browser, but not in the device. I thought it might be an issue with the jQuery Mobile, so I even tried disabling it, but doesn't help. </p> <p>Android version: 3.0</p> <p>This is my code: </p> <pre><code>&lt;link rel="stylesheet" href="css/themes/default/jquery.mobile-1.1.0.css" /&gt; &lt;script src="js/jquery.js"&gt;&lt;/script&gt; &lt;script src="js/jquery.mobile-1.1.0.js"&gt;&lt;/script&gt; &lt;script src="cordova-2.1.0.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function cancelclicked() { window.location.href="index.html"; } function jsonp_call() { // The call request here } function parseRequest(response) { // Parse the response here } &lt;/script&gt; </code></pre> <p> </p> <pre><code>&lt;div data-role="page" class="type-interior"&gt; &lt;div data-role="header" data-theme="b"&gt; &lt;h1&gt;Login&lt;/h1&gt; &lt;/div&gt; &lt;div data-role="content"&gt; &lt;div class="content-primary"&gt; &lt;div data-role="fieldcontain"&gt; &lt;label for="name"&gt;Username:&lt;/label&gt; &lt;input type="text" id="uname" /&gt; &lt;/div&gt; &lt;div data-role="fieldcontain"&gt; &lt;label for="name"&gt;Password:&lt;/label&gt; &lt;input type="password" name="name" id="pass" /&gt; &lt;/div&gt; &lt;div data-role="fieldcontain"&gt; &lt;label for="name" id="invalidlogin"&gt;&lt;/label&gt; &lt;/div&gt; &lt;div class="ui-body ui-body-b"&gt; &lt;fieldset class="ui-grid-a"&gt; &lt;button type="submit" onclick="return jsonp_call()" data-theme="e" rel="external"&gt;Login&lt;/button&gt; &lt;!--&lt;/form&gt;--&gt; &lt;button type="submit" onclick="cancelclicked()" data-theme="d"&gt;Cancel&lt;/button&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p></p> <p>What am I missing here? It works fine on a browser, so I'm quite sure that the JSONP code is correct. It fails on the emulator and the device as well.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload