I am receiving a large JSON object having large volume of data in ajax success method but when i am iterating over the JSON list and want add individual class to each element things are not working.
The code snippet i am pasting here is inside ajax success method
$.each(data, function(index,jsonObject){
    console.log(jsonObject.spanId+":"+jsonObject.status)
    if(jsonObject.status != null && jsonObject.status != undefined){
        if(jsonObject.status == "Available"){
        $('#'+jsonObject.spanId).addClass("availableTime");
        }else{
        $('#'+jsonObject.spanId).addClass("vacantTime");
        }
    }
});
I have tried lot but not able to accomplish, please help me.
I am adding chunk of my json object
[
    {
        "spanId": null,
        "status": null
    },
    {
        "spanId": null,
        "status": null
    },
    {
        "spanId": "25_31_15:00",
        "status": "Available"
    },
    {
        "spanId": "25_31_15:30",
        "status": "Available"
    },
    {
        "spanId": "25_31_16:00",
        "status": "Available"
    },
    {
        "spanId": "25_31_16:30",
        "status": "Available"
    },
    {
        "spanId": "25_31_17:00",
        "status": "Available"
    }
]
 
     
     
     
    