Suppose I have an Ajax function that displays the new data every 5 seconds. Now, whenever the new data is pushed (displayed) I want to change the css (class="av") colour of that particular value. The ajax is currently displaying 5 rows, but I want to change the colour only of that changed value. How do I do that? many thanks

my code:

```
    <script type="text/javascript">

            $(document).ready(function(){

                //function to get data from database
                function getRealData(){
                    $.ajax({ 
                    url: 'test_api.php', 
                    data: "", dataType: 'json', 
                    success: function(rows) { 

                    var text = '';

                        for (var i in rows) { 

                            var row = rows[i]; 

                            var availability = row[3]; 

                            var hostName = row[2];

                            var intranet = row[6];

                            var timeRespons = row[4]; 

                            text += "<div class='box'><b>availability: </b><span class='av'>"+availability+"</span><b> hostName: </b>"+hostName+
                            "<b> intranet: </b>"+intranet+"<b> timeResponse: </b>"+timeRespons;
                            text += '<br/ ></div>';

                        }
                        $("#content").html(text);                                       
                    }
                });
                }

                //this refreshes data every 2seconds
                setInterval(getRealData, 5000);

                //call the function to display data
                getRealData();

                //notification
                function notify(){

                var avValue = $(".av").html();

            console.log(avValue);

            if(avValue == 1){
                $(".av").css({"color":"red"});
            }
        }

        setInterval(notify, 2000);

        notify();

});

</script>

```

EDIT: (this the output, and Need to change the colour of 1)

```
availability: 1 hostName: aaa intranet: vvvvv timeResponse:0.144
availability: 0 hostName: zzz intranet: rrrrr timeResponse:0.028
availability: 1 hostName: qqq intranet: eeeee timeResponse:0.160
availability: 0 hostName: eee intranet: qqqqq timeResponse:0.116
availability: 0 hostName: ttt intranet: wwwww timeResponse:0.046
availability: 0 hostName: uuu intranet: kkkkk timeResponse:0.116

```

I was also thinking to add a new class to .box when avValue == 1 and then based on that if that class exists to do something. but this doesn't work either. It is very strange. could that be something to do with async or caching ajax?