PhoneGap Ajax call not working

I’m Trying to make an app that uploads Images. I use PhoneGap to build it for Android.

I can’t seem to get the AJAX call I use to upload the Images, working. My AJAX call is this:

        url: '' + i + '/' + i + '/veilingmeester',
        cache: false,
        type: "POST",
        processData: false,
        contentType: false,
        data: formData[i],

        headers: {
            'Access-Control-Allow-Origin': '*.*',
            'connect-src': 'http://localhost:53827'
        success: function (data) {
            //met deze data moeten we nu een object aamaken voor de database

        error: function (jqXHR, err) {
            LogError("error:" + err);
            LogError("jqXHR:" + jqXHR);
            LogError("jqXHR.status:" + jqXHR.status);
            LogError("jqXHR.statustext:" + jqXHR.statusText);

So I already searched around SF, but I can’t get it to work. My config.xml looks like this:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.dangoo.img" version="0.0.1" xmlns="" xmlns:cdv="">
<name>Dangoo Pics</name>
    Upload plaatjes naar de Dangoo server. Vermakkelijk het proces van producten toevoegen!
<author email="" href="">
    Certigon Development Team
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" version="1" />
<access origin="http://localhost:53827/*" />
<allow-navigation href="http://localhost:53827" />
<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="android">
    <allow-intent href="market:*" />
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />

I use this plugin:

I added these permissions:

 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

I tried searching for the answer in many ways, but I can’t seem to find the solution for this problem. If I need to specify anything, please tell me and I’ll update ASAP.

Greets, Mick

Source: ajax

Leave a Reply