I have the following JSON returned from a remote server:
{
"success": true,
"questions": [{
"id": 23,
"text": "Is Sky Blue?",
"response_type": "Multiple Choice",
"created_at": "2014-12-05T06:37:20.947Z",
"updated_at": "2015-03-04T00:00:56.915Z",
"campaign_id": 38,
"no_repeats": true,
"max_repeat": 0,
"yes_no": false,
"type": "axy",
"priority": 0
}, {
"id": 24,
"text": "What is your current employment status?",
"response_type": "Multiple Choice",
"created_at": "2014-12-05T06:38:56.076Z",
"updated_at": "2015-03-04T00:00:56.903Z",
"campaign_id": 38,
"no_repeats": true,
"max_repeat": 0,
"yes_no": false,
"type": "axy",
"priority": 0
}]
}
I am using this code to fetch data from remote URL:
$.get( url, function( data ){
alert(data.success); // Works
alert(data. questions); // Returns Blank
});
data.questions returns empty. I tried to eval but it just returns [object]
What's wrong am I doing?
jsonbut it does returnsuccessastrue