Results 1 to 4 of 4

Thread: Ext.Ajax.request

  1. #1
    Sencha User
    Join Date
    Apr 2010
    Location
    Warsaw, Poland
    Posts
    58

    Default Ext.Ajax.request

    I have a json file with some data, I'm using this code to extract it. What's the best way to read the datalabels field from jobs_per_day?
    Code:
    Ext.Ajax.request({
        url: 'js/RenderfarmStats/august_2010.json'
    });
    screenshot20100905at914.png

    I wish to use datalabels information in another function:
    Code:
    jobsPerDay.addAxis('y1', {type: 'y', labels: DATALABELS_HERE});

  2. #2
    Sencha User sosy's Avatar
    Join Date
    Jun 2010
    Location
    Bremen, but Dutch origin
    Posts
    64

    Default

    Hi Zen,

    if you look here, i think you will be able to find some stores which use json.

    http://www.sencha.com/learn/Tutorials

    Regards
    Sosy
    I prefer an sister in the red-light district, to an brother with internet explorer..

  3. #3
    Sencha Premium User StuartAshworth's Avatar
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    418

    Default

    Add a success parameter to the request call, parse the JSON result and use your value as you need.

    The code below is copied pretty much exactly from the docs...

    Code:
    Ext.Ajax.request({
       url: 'js/RenderfarmStats/august_2010.json',
       success: function(response, opts) {
          var obj = Ext.decode(response.responseText);
          
          // access data labels via "obj[0].datalabels"
    
       },
       failure: function(response, opts) {
          console.log('server-side failure with status code ' + response.status);
       }
    });
    Stuart

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Shouldn't you be thinking in terms of Objects, and loading a Store?

Similar Threads

  1. add a param to all Ext.Ajax.request (tree, store, normal Ajax.request)
    By aj3423 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 26 Jan 2010, 9:18 AM
  2. 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
  3. Problem in send ajax request :The Ext.Ajax is null or not Object
    By flyingpig in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 27 Aug 2007, 11:29 PM
  4. Ext.Ajax.request return Ext.Ajax has no properties
    By etiennesamson in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 4 Aug 2007, 11:43 PM

Posting Permissions

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