Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap / Android WebView throws "Unknown chromium error: 0"
    text
    copied!<p>I'm currently developing a project using PhoneGap and I need to do an ajax request to my local webserver which has already:</p> <p>PHP code</p> <pre><code>header('Access-Control-Allow-Origin: *'); </code></pre> <p>Anyway, when I do an ajax request with jQuery on Android I get this error (in adb logcat):</p> <pre><code>D/chromium(23078): Unknown chromium error: 0 </code></pre> <p>The Javascript code is:</p> <pre><code>$.ajax({url:"http://192.168.1.219/works/privati/folder/api.php/getlastmaginfo",dataType:"json",success:function(data) { console.log("Finished loading by ajax"); console.log(data); }}); </code></pre> <p>In Ripple Emulator works as expected, in Android nope.</p> <p>Any suggestion? Thank you for the help!</p> <p><strong>UPDATE 2013-08-21:</strong></p> <p>After some researches I came at the conclusion that $.ajax won't work with PhoneGap (don't know why, maybe a bug?). We must use $.get instead, but when I do a request with $.get I get <code>Unknown chromium error: -6</code> I also read <a href="https://code.google.com/p/android/issues/detail?id=17535" rel="nofollow">here</a> that the problem is due to an Android's bug with the WebView URL mechanism.</p> <p>I'll continue my research until I find a good and working solution</p> <p><strong>UPDATE 2013-08-21 (2):</strong> Not even using this works...</p> <pre><code>var fileTransfer = new FileTransfer(); fileTransfer.download( "http://192.168.1.219/works/privati/qlipmag/api.php/getlastmaginfo", "json.json", function(entry) { console.log("OKAY"); }, function(error) { console.log(error); } ); </code></pre> <p>Error is at <code>new FileTransfer();</code> => <code>Uncaught ReferenceError: FileTransfer is not defined</code></p> <p><strong>UPDATE 2013-08-22:</strong></p> <p>It doens't work even by loading an external image:</p> <p><code>&lt;img src="http://externalhost.com/image.jpg"/&gt;</code></p> <p>Same error.</p> <p>In android manifest file I already setted permission:</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt; </code></pre> <p>I don't really know from where comes the problem...</p> <p><strong>UPDATE 2013-08-27:</strong> I tried the same code on PhoneGap for iPhone (in iPhone Emulator) and the ajax request was successfull when I used an external website. Using an external website also on android doesn't get the same result. Same error.</p> <p>Anybody can see why? Access origin are setted fine...</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