ajax logic to show pics