Software Archive
Read-only legacy content
17061 Discussions

same Ajax RQST -2 different responses: from xdk emulator = OK but from wifi device error 401

Azouz_Z_
Beginner
364 Views

Hello,

I am doing the ajax logging request written below. From the emulator, it is ok, the request work very well. But from the device connected (wifi+USB) i get the error 401.

Do you have a track to solve this problem?

server ip address : 192.168.0.10

django server :http://192.168.0.10:8000/

iphone ip/wifi address : 192.168.0.15

 

Here is the code

LOGIN_URL = http://192.168.0.10:8000/api/v1/

    alert("Sending ajax login request"+LOGIN_URL);
        $.ajax({
            url: LOGIN_URL,
            username: username,
            password: password,
            success: function(data) {
                alert("SignIn :Success sending ajax login request");
                        $.ui.loadContent("nextpage", null, null, "fade");
            },
            error: function(xhr) {
                if(xhr.status == 401) {
                    alert("xhr.status= " + xhr.status);
                    $.ui.popup("Authentication failed. Check your username and password.");
                }
            }
        });

Very Best Regards

 

0 Kudos
1 Reply
Elroy_A_Intel
Employee
364 Views

I recommend that you include a * (asterisk) in the Domain List field on the Project panel for your application. The asterisk allows for communication to any web server or site via your application or AJAX call. You can find the Domain List field with in the Cordova Hybrid Mobile App settings > Build Settings > (desired platform such as Android, iOS etc...)

0 Kudos
Reply