Sideshow
Sideshow

Reputation: 1351

Get value from header JQuery

I need to extract the address from a returned header - the data being returned is as follows

{
    "error": false,
    "error_msg": "",
    "body": {
        "records": [
            {
                "address": "/Clients/I/imi_bit_contact_dev/web/app_dev.php/api/v/1/address/46813"
            }
        ]
    },
    "validation_errors": []
}

Currently there is only one address being returned and I need to grab this address (full url) for further usage.

Upvotes: 0

Views: 450

Answers (1)

Paul Rad
Paul Rad

Reputation: 4882

Simply

data.body.records[0].address

where data is your returned response

Or

for (var i = 0; i < data.body.records.length; i++)
{
 var address = data.body.records[i].address;
 alert (address);
}

to get the multiples rows.

Upvotes: 3

Related Questions