Adding checkmark icon to product added in cart using PHP/Jquery

I am trying to add a checkmark to the products that have been added to cart. I am using ajax to return. But i know i am doing wrong. I got a bit lost. I made with php first,and it works,but only displays when i refresh the page. My php code...

Suggest you isolate an example that is a little more succinct -- it will help us find the important moving parts.

In the instant case, I believe that the use of the class= attribute may be part of the issue. Classes do not need to be unique, but id= attributes need to be unique. So if you only want one of the elements to change, you might want to identify it with an id instead of a class. in jQuery the class indicator is the dot (like ".item") and the id indicator is the hashtag (like "#item").

Personally, I prefer to use something different for these tasks. I would place the markup for the checkmark in each product setting its display property to none. Then, when user add the product to the cart, you just need to get the success result to add class 'visible'.
Somwthing like this: