Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap + jQuery android app; ajax request runs in browser but not on phone or emulator
    text
    copied!<p>I am working on an app which has to load data from a Microsoft Dynamics NAV SOAP web service. When I run the code in a browser (IE9 or Chrome v 26.0...) the code does what it should. But when I test the code on an android emulator or a real device (htc sensation) the ajax call fails and I get the XMLHttpRequest error 0.</p> <p>However, I could also load data from different web-services without basic authentication on android systems.</p> <p>My whitelist (located in res/xml/config.xml) looks like this:</p> <pre><code>&lt;access origin="*" /&gt; &lt;plugins&gt; ... // all other possible plugins &lt;plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/&gt; &lt;/plugins&gt; </code></pre> <p>and here the code:</p> <pre><code>function readTimeRecords(callback) { var wsUrl = 'http://.../WS/CRONUS%20AG/Page/Time_Recording'; var soapMessage = '&lt;?xml version="1.0" encoding="utf-8"?&gt;' + '&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;' + '&lt;soap:Body&gt;' + '&lt;ReadMultiple xmlns="urn:microsoft-dynamics-schemas/page/time_recording" &gt;' + '&lt;filter&gt;' + '&lt;Field&gt;No&lt;/Field&gt;' + '&lt;/filter&gt;' + '&lt;bookmarkKey /&gt;' + '&lt;setSize&gt;' + '5' + '&lt;/setSize&gt;' + '&lt;/ReadMultiple&gt;' + '&lt;/soap:Body&gt; ' + '&lt;/soap:Envelope&gt;'; // enable cross site requests in IE $.support.cors = true; $.mobile.allowCrossDomainPages = true; $.ajax({ url : wsUrl, type : "POST", dataType : "text", data : soapMessage, processData : false, contentType : "text/xml", password : "passwd", username : "domain\\user", beforeSend : function(xhr) { xhr.setRequestHeader('SOAPAction', 'urn:microsoft-dynamics-schemas/page/time_recording'); }, success : function(msg) { ... callback(record); }, error : onError }) } function onError(XMLHttpRequest, textStatus, errorThrown) { debugger; console.log("error: " + textStatus + ", errorThrown: " + errorThrown); // i just get the message error: error: } </code></pre> <p>Does someone know how to fix that issue?</p> <p>used setup: jquery.mobile-1.3.0 jquery-19.1 cordova-2.5</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