1. #1
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    xuronghua is on a distinguished road

      0  

    Default Unanswered: Ext.Model can't get data from remote server

    Unanswered: Ext.Model can't get data from remote server


    this is my code:

    Code:
    Ext.regModel('UserTask', {
        fields: ['ret_code', 'ret_desc'],
    proxy:{
    type:'ajax',
            url: 'http://localhost/api.php',
    reader: 'json'
        },
    
    });
    
    var user3=Ext.ModelMgr.getModel('UserTask');
    user3.load(null, {
        success: function(record, operation) {
            console.log(record);
            console.log(operation);
        }
    });
    remote server response text is :
    {"ret_code":"SUCC","ret_desc":"","task":"abc"}


    the result return is :
    record is undefined

  2. #2
    Sencha User
    Join Date
    Aug 2010
    Posts
    303
    Answers
    3
    Vote Rating
    3
    steve1964 is on a distinguished road

      0  

    Default


    I dont see any store in your code, you need a model and store, you are mixing model and store param in your model definition...

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    xuronghua is on a distinguished road

      0  

    Default


    thanks your reply

    store is multiple Model.
    i just want to load one record to Model, not a store

    i read the docs api (http://dev.sencha.com/deploy/touch/docs/), the example code in "Using Proxy" can resolve my question, but do not work.

  4. #4
    Ext JS Premium Member
    Join Date
    Aug 2011
    Posts
    6
    Vote Rating
    0
    xuronghua is on a distinguished road

      0  

  5. #5
    Sencha - Services Team
    Join Date
    Mar 2007
    Location
    Foristell, MO
    Posts
    1,108
    Answers
    12
    Vote Rating
    3
    jratcliff is on a distinguished road

      0  

    Default


    The issue is with your server's response. When you load data into a store the data needs to be an Array of whatever you are loading. So if you are loading in Json, you need an array of json objects. So just wrap your response in square brackets and then your code will work.
    Jack Ratcliff
    Sencha Inc, Green bleeding Senchan

    How to report a bug:
    http://www.sencha.com/forum/showthre...o-report-a-bug

Thread Participants: 2

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..." hd porno faketaxi