Added a jquery when method to perform action after photos are retrieved