Adding to wait for ajax to finish on page