Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Exclamation Ajax/JSONP request doesn't work..

    Ajax/JSONP request doesn't work..


    I am trying to call a remote server that returns JSON using Ajax. I am using ST 2.0.0pr1 and phonegap 1.1.0.

    I do not understand why this doesn't work:

    Code:
           Ext.Ajax.request({
                url: url,
                success: function(response) {
                    console.log(response);
                    // process server response here
                }
            });
    while this does:

    Code:
               var ajax = new XMLHttpRequest();
               ajax.open("GET",url,true);
               ajax.send();           ajax.onreadystatechange=function(){
                console.log('ajax response!');
                if(ajax.readyState==4 && (ajax.status==200)){
                 console.log('200 response!')
                 console.log(ajax.responseText);
               }

  2. #2
    Ext JS Premium Member
    Join Date
    Jun 2010
    Posts
    1
    Vote Rating
    0
    jedi is on a distinguished road

      0  

    Default


    hi,

    this is probably due to the new whitelist feature of phonegap. if you're working on xcode you should be able to add domain names in file PhoneGap.plist (under <project name>/Supporting Files). there's a section called ExternalHosts. add your remote domains there (wildcards work).

    here's a screenshot: http://www.prosoxi.com/2011/10/08/xc...ist-rejection/
    @wuher

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Default


    Unfortunately, that's not the problem because I already have the server host name in the whitelist and it works with a straight Javascript AJAX request.

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    80
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I'll be honest. I don't think that this is a Sencha touch issue. Try using this inside of mobile safari. Does it work? Also, try setting a failure callback and inspecting the results.

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Posts
    127
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Default


    Quote Originally Posted by jgarcia@tdg-i.com View Post
    I'll be honest. I don't think that this is a Sencha touch issue. Try using this inside of mobile safari. Does it work? Also, try setting a failure callback and inspecting the results.
    Thanks. So my above code looks right?

    And should the failure callback look like this below?

    Code:
    failure:  function(response) {                console.log(response);                // process server response here            }

  6. #6
    Touch Premium Member
    Join Date
    Nov 2007
    Posts
    38
    Vote Rating
    0
    knifegun is on a distinguished road

      0  

    Default


    I also think this has to be an issue with whitelisting and/or issues with your code. I can run Sencha Touch 2 via PhoneGap 1.1 on iOS. It makes JSONP calls successfully.

  7. #7
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    I heard reports of this at SenchaCon too. Moving this to the bug forum so we can investigate and verify.

  8. #8
    Sencha User
    Join Date
    Jul 2014
    Posts
    6
    Vote Rating
    0
    melba is on a distinguished road

      0  

    Default JSONP QUERY_STRING lost

    JSONP QUERY_STRING lost


    I wrote a lttle Sencha Touch App and compiled it as cordova android native.

    All is fine, but....

    the JSONP Ajax call behaves entirely different in the native app as it does from a browser

    name: _dc, value: 1405366253614
    ({"passwd":"","vorname":"Peter","status":"invalid","nachname":"Betzler","login":"Peter"})CONTENT_LENGTH = 91<br>
    CONTENT_TYPE = application/json<br>
    DOCUMENT_ROOT = /var/www/datapat<br>
    GATEWAY_INTERFACE = CGI/1.1<br>
    HTTP_ACCEPT = */*<br>
    HTTP_ACCEPT_ENCODING = gzip,deflate<br>
    HTTP_ACCEPT_LANGUAGE = de-DE,en-US;q=0.8<br>
    HTTP_CONNECTION = keep-alive<br>
    HTTP_HOST = www.datapat.de<br>
    HTTP_ORIGIN = file://<br>
    HTTP_USER_AGENT = Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.
    0 Chrome/33.0.0.0 Mobile Safari/537.36<br>
    HTTP_X_REQUESTED_WITH = XMLHttpRequest<br>
    PATH = /usr/local/bin:/usr/bin:/bin<br>
    QUERY_STRING = _dc=1405366253614<br>
    REMOTE_ADDR = 46.244.135.88<br>
    REMOTE_PORT = 54674<br>
    REQUEST_METHOD = POST<br>
    REQUEST_URI = /perl/PLS/login.pl?_dc=1405366253614<br>
    SCRIPT_FILENAME = /var/cgi-bin/datapat/PLS/login.pl<br>
    SCRIPT_NAME = /perl/PLS/login.pl<br>
    SERVER_ADDR = 195.122.150.137<br>
    SERVER_ADMIN = webmaster@localhost<br>
    SERVER_NAME = www.datapat.de<br>
    SERVER_PORT = 80<br>
    SERVER_PROTOCOL = HTTP/1.1<br>
    SERVER_SIGNATURE = <address>Apache/2.2.14 (Ubuntu) Server at www.datapat.de Port 80</address>
    <br>
    SERVER_SOFTWARE = Apache/2.2.14 (Ubuntu)<br>
    Login:
    Passwd:
    POST: {"login":"","passwd":"","vorname":null,"nachname":null,"status":null,"id":"ext-record-346"}
    ({"passwd":"","vorname":"Peter","status":"invalid","nachname":"","login":"Peter"})
    The Ajax request is considered to be REQUEST_METHOD = POST
    No QUERY parameters are visible.

    Now the same as sencha cmd app in android device crome browser

    name: passwd, value:
    name: _dc, value: 1405366753603
    name: page, value: 1
    name: callback, value: Ext.data.JsonP.callback8
    name: limit, value: 25
    name: start, value: 0
    name: login, value: Peter
    Ext.data.JsonP.callback8({"passwd":"","vorname":"Peter","status":"valid","nachname":"","login":"Peter"})DOCUMENT_ROOT
    = /var/www/dataxxx<br>
    GATEWAY_INTERFACE = CGI/1.1<br>
    HTTP_ACCEPT = */*<br>
    HTTP_ACCEPT_ENCODING = gzip,deflate,sdch<br>
    HTTP_ACCEPT_LANGUAGE = de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4<br>
    HTTP_CONNECTION = keep-alive<br>
    HTTP_HOST = www.dataxxx.de<br>
    HTTP_REFERER = http://www.dataxxx.de:1841/<br>
    HTTP_USER_AGENT = Mozilla/5.0 (Linux; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.
    0.1916.141 Mobile Safari/537.36<br>
    PATH = /usr/local/bin:/usr/bin:/bin<br>
    QUERY_STRING = _dc=1405366753603&login=Peter&passwd=&page=1&start=0&limit=25&callback=Ext.data.JsonP.callback8<br>
    REMOTE_ADDR = 46.244.135.88<br>
    REMOTE_PORT = 54695<br>
    REQUEST_METHOD = GET<br>
    REQUEST_URI = /perl/PLS/login.pl?_dc=1405366753603&login=Peter&passwd=&page=1&start=0&limit=25&callback=Ext.data.JsonP.callb
    ack8<br>
    SCRIPT_FILENAME = /var/cgi-bin/dataxxx/PLS/login.pl<br>
    SCRIPT_NAME = /perl/PLS/login.pl<br>
    SERVER_ADDR = 195.122.150.137<br>
    SERVER_ADMIN = webmaster@localhost<br>
    SERVER_NAME = www.dataxxx.de<br>
    SERVER_PORT = 80<br>
    SERVER_PROTOCOL = HTTP/1.1<br>
    SERVER_SIGNATURE = <address>Apache/2.2.14 (Ubuntu) Server at www.dataxxx.de Port 80</address>
    <br>
    SERVER_SOFTWARE = Apache/2.2.14 (Ubuntu)<br>
    Login: Peter
    Passwd:
    POST:
    Ext.data.JsonP.callback8({"passwd":"","vorname":"Peter","status":"valid","nachname":"","login":"Peter"})
    Now the Ajax call is fine and is a GET Request and I see my QUERY Parameters.

    Can anybody help?

    Thank you

    Peter

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."