the ajax load didn't work well.

Replace the .data() by the hasclass() method to see if an image exists, otherwise it works badly (duplicates the images when calling twice).