ajax request working but rendering assets twice causing gallery images to be loaded twice