ajax request is not working on android

2 posts, 0 answers
  1. Marco
    Marco avatar
    3 posts
    Member since:
    Jul 2014

    Posted 25 Oct Link to this post

    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?

  2. Preslav
    Admin
    Preslav avatar
    51 posts

    Posted 27 Oct Link to this post

    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.

     
Back to Top