Функция complete возвращается после удачного получения заголовка 200 (ОК), поэтому так и происходит.
$.ajax({
url: urlData,
type: "get",
async: true,
cache: false,
timeout: 30000,
success: function(data) {
if (data.length > 0) {
var template = Handlebars.compile($('#templateInvoice').html());
/**
* Создаём новый промис, чтобы убедиться на 101%
* @param {Function} resolve [description]
* @param {Function} reject [description]
* @return {Promise} [description]
*/
const promiseBuilding = new Promise((resolve, reject) => {
/**
* Можете потом убрать
* @return {[type]} [description]
*/
setTimeout(() => {
resolve('Complete')
}, 300)
})
promiseBuilding.then(() => {
resultContainer.html(template(data))
})
}
}
});