Try to avoid reload by waiting for ajax to finish.