using a promise to ensure rendering happens after ajax load