Insert promise to avoid ajax request