QUIPHOP
QUIPHOP

Reputation: 93

Phonegap developer app doesn't send ajax

I'm using phonegap and develop via local server (phonegap serve). Ajax worked perfect before but now in doesn't. Now just when i'm call ajax function nothing happens. What I have done:

1) Edited config.xml and add

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

2) Edited AndroidManifest.xml <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permissions.NETWORK_ACCESS" />

3)Use jsonp instead of json. It works but return 404

4)Urls and params are ok as before, problem isn't here

5)apk-build works fine at all android-devices

6)Re-install phonegap app and reset android to facroty data

7) Example of my ajax

app.ajax = {

load: function(method, url, data, onSuccess) {

    var beforeSend = function() {
        $('body').append($('<i class="loading-icon"></i>'));
    };

    var onComplete = function() {
        $('.loading-icon').remove();
    };
    var onError = function(jqXHR, textStatus, errorThrown){
      console.log(jqXHR);
    };
    $.ajax({
        method: method,
        url: url,
        data: data,
        beforeSend: beforeSend,
        success: onSuccess,
        complete: onComplete,
        error: onError
      });
}};

8)Node version: v0.10.25 Cordova version: 5.1.1

Upvotes: 0

Views: 533

Answers (1)

user3255670
user3255670

Reputation:

@KENMAN143, on #3 it clearly says 404 (meaning: file not found). Since you have done this before, I assume you are treating the event deviceready correctly. That leaves the NEW plugin required for whitelist. This is easy to miss since it is NOT on the blog, but posted to the forum.

Notes for upgrading to cli-5.1.1 on PGB
http://community.phonegap.com/nitobi/topics/notes-for-upgrading-to-cli-5-1-1-on-pgb

You can read other missed topics on my blog
(Official) Messages from Phonegap Build Technical Support in the Forum
http://codesnippets.altervista.org/documentation/phonegap/bookmarks/fromSupport.html

Upvotes: 1

Related Questions