1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    46
    Vote Rating
    0
    eaglefox12 is on a distinguished road

      0  

    Default Answered: Get total number of objects returned from ajax request

    Answered: Get total number of objects returned from ajax request


    I get a json object by making this ajax request. I would like to know the total number of objects, but on alert, all I get is undefined. how do you get the number of object returned.
    here is my json
    Code:
        [{
            "Id": 1,
            "Value": 10
        },
        {
            "Id": 2,
            "Value": 100
        },
        {
            "Id": 3,
            "Value": 1000
        },
        {
            "Id": 4,
            "Value": 10000
        }]
    and here is my ajax request. What I am looking for is total record = 4

    Code:
    Ext.Ajax.request({
                url: 'MyApp/getRecord',
                method: 'GET',
                scope: this,
                headers: { 'Content-Type': 'application/json' },
                dataType: 'json',
                success: function (response) {
                    this.returnedValue = Ext.JSON.decode(response.responseText);
                    alert(this.returnedValue.count);
                },
                failure: function (response) { }
            });
    Last edited by eaglefox12; 23 Apr 2013 at 1:19 PM. Reason: correct json

  2. Try length instead of count. Or better yet play with it in the Firebug console, "alert" isn't very useful for figuring out what your object looks like.

  3. #2
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    667
    Answers
    15
    Vote Rating
    18
    carol.ext will become famous soon enough carol.ext will become famous soon enough

      0  

    Default


    Try length instead of count. Or better yet play with it in the Firebug console, "alert" isn't very useful for figuring out what your object looks like.

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    46
    Vote Rating
    0
    eaglefox12 is on a distinguished road

      0  

    Default Thank you

    Thank you


    Thank you sir... Length was the right answer I was looking for

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar