Results 1 to 4 of 4

Thread: Ext.Ajax.request not working on mobile device

  1. #1
    Sencha User
    Join Date
    May 2015
    Posts
    13

    Default Ext.Ajax.request not working on mobile device

    Hello everybody, I was trying to build an app with sencha touch 2, and phonegap, I'm using online phonegap build service, http://build.phonegap.com


    I have a problem, the app is working perfectly fine on my computer, on all browsers, and it is also working fine on mobile phone when I open it from chrome browser, I also tried 'Phonegap App Desktop' which runs a server that transfers the app to your mobile device, the app works on the mobile there as well.


    But not when I build the apk and install it on my mobile. Everything works except the Ajax request, here's a snippet for my ajax request.


    Code:
        Ext.Ajax.request({
            url: 'http://192.168.0.200/DVD/store.php',
            timeout:80000,
            callback: function(options, success, response) {
                var home = Ext.getCmp('home');
                home.setHtml(response.responseText);
            }
        });
    I was devastated cause' I could swear it worked before, so I created a new out of the box app and created a button, and added the above function to it, but that did not work.


    What I'm doing is, building the app with sencha `sencha app build android`
    Then I zip the android dir content, upload it to phonegap build service, and I then install it on my phone, everything works except the ajax request.


    I don't have android SDK on my computer so I have to use phonegap online build


    What am I missing here?


    Thanks

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    What isn't working regarding the Ajax request? Is it failing to make the request, not processing the response, or something else? Are you getting any error messages accompanying this issue?

    Thanks
    Joel

  3. #3
    Sencha User
    Join Date
    May 2015
    Posts
    13

    Default

    On the computer it works fine, so no error messages, but on the mobile device I am unable to debug so I can't see any error messages, but I am sure callback function is not being called, the request is not being made at all. I can confirm this because I have set the PHP file to create a file on the disk when it is requested.

    So the request is not going through or something, and the callback function is not being triggered, I don't have android SDK, is there a way for me to remotely debug my apps?

    I believe the build process by phonegap is causing this, but I don't know how or why.
    As I mentioned before, I created a new project and did not modify it, trying to isolate the problem, I just edited the main view, here it is:
    Code:
    Ext.define('ajaxTest.view.Main', {
        extend: 'Ext.tab.Panel',
        xtype: 'main',
        requires: [
            'Ext.TitleBar',
            'Ext.Video',
            'Ext.Ajax'
        ],
        config: {
            tabBarPosition: 'bottom',
    
    
            items: [
                {
                    title: 'Welcome',
                    iconCls: 'home',
                    id: 'home',
                    styleHtmlContent: true,
                    scrollable: true,
                    items: {
                        docked: 'top',
                        xtype: 'titlebar',
                        title: 'Welcome to Sencha Touch 2',
                    },
    
    
                    html: [
                        "You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ",
                        "contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ",
                        "and refresh to change what's rendered here."
                    ].join(""),
                },
                {
                  xtype: 'button',
                  iconCls: 'refresh',
                  handler: function(){
                      Ext.Ajax.request({
                        url: 'http://192.168.0.200/DVD/store.php',
                        timeout:80000,
                        callback: function(options, success, response) {
                        var home = Ext.getCmp('home');
                        home.setHtml(response.responseText);
                        }
                      });
                  },
                }
            ]
        }
    });
    Then I ran 'sencha app build android', I zipped the contents of android directory and uploaded them to phonegap.

  4. #4
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    Have you tried using GapDebug to debug the application?

    https://www.genuitec.com/products/gapdebug

    Thanks
    Joel

Similar Threads

  1. Replies: 1
    Last Post: 25 Jun 2015, 2:27 AM
  2. Ext.Ajax.request CORS not working
    By marco.napetti in forum Ext 5: Q&A
    Replies: 5
    Last Post: 17 Oct 2014, 12:01 AM
  3. Ext.Ajax.Request not working in browser
    By ajnaidas in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 11 Jul 2013, 2:24 AM
  4. autoLoad vs Ext.Ajax.request... loadScripts not working w/Ajax.request
    By zhegwood in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 6 Aug 2009, 3:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •