This is a migrated thread and some comments may be shown as answers.

ajax request is not working on android

1 Answer 217 Views
Google Android
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marco
Top achievements
Rank 1
Marco asked on 25 Oct 2016, 08:55 AM

I have an app, that connects with the given host via a form,

where user will give the host details like "http://abc.com" then my code will connect it to the given host.

(function (parent) {
    var
        /// start global model properties
        /// end global model properties
        hostname,
        hostModel = kendo.observable({

            submit: function () {
                var hostname = parent.get('addFormData.hostname');
                if (hostname != "") {
                    $.ajax({
                        url: hostname + '/InstalltionAPI/GetDomain/',
                        dataType: 'JSON',
                        type: 'GET',
                        success: function (args) {
                            alert("success");
                            localStorage.setItem("aportWarehouseHost", args.Message);
                            window.APP.mobileApp.navigate("components/login/view.html");
                        },
                        error: function () {
                           alert("error");
                        }
                    });
                }
            },
         });


    parent.set('onShow', function _onShow() {
        var that = parent;
        that.set('addFormData', {
            hostname: '',
        });
    });
    parent.set('hostModel', hostModel);
})(app.host);

 

apart from that every other ajax request is not working... am I missing something?

1 Answer, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 27 Oct 2016, 02:59 PM
Hi Marco,

Based on your description, I believe that the Cordova Whitelist Plugin is not included in your project. 

To fix this faulty behavior, you should follow the solution outlined in the AJAX jQuery Request Do Not Work on Android knowledge base article.

Please, let me know if this is helpful.

Regards,
Preslav
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Google Android
Asked by
Marco
Top achievements
Rank 1
Answers by
Preslav
Telerik team
Share this question
or