 I have a
I have a jQuery call which is getting the data in to a object.
I'm trying to use the object value to set as a label text from javascript, but it throws 
"Cannot read property '0' of undefined."
where as it prints the value successfully to the console.
var questionData;
var optionData;
$(document).ready(function () {    
    $.ajax({
        url: 'coaching-assessment-tool.aspx/GetCATQuestionAndOptions',
        type: 'POST',
        dataType: 'json',
        contentType: "application/json; charset=utf-8",
        success: function (data) {            
            questionData = data.d[0];
            optionData = data.d[1];           
            console.log(questionData[0].QuestionText);
            console.log("Question Data", questionData);
            console.log("Option Data", optionData);
        },
        error: function (error) {
            console.log(error);
            alert('Error retrieving data. Please contact support.');
        }        
    });
    document.getElementById('firstQuestion').innerHTML = questionData[0].QuestionText;
});I need the label text as the object value (questionData[0].QuestionText).
 
    