31 lines
881 B
JavaScript
31 lines
881 B
JavaScript
/**
|
|
* Loads support-cta.section.html into #support-cta-module
|
|
*/
|
|
(function () {
|
|
var MODULE_URL = '/pages/modules/support-cta.section.html';
|
|
|
|
function loadSupportCtaModule() {
|
|
var container = document.getElementById('support-cta-module');
|
|
if (!container) return;
|
|
|
|
fetch(MODULE_URL, { credentials: 'same-origin' })
|
|
.then(function (res) {
|
|
if (!res.ok) throw new Error('Failed to load ' + MODULE_URL);
|
|
return res.text();
|
|
})
|
|
.then(function (html) {
|
|
container.innerHTML = html;
|
|
document.dispatchEvent(new CustomEvent('aifo:support-cta-ready'));
|
|
})
|
|
.catch(function (err) {
|
|
console.error('[support-cta-module.js]', err);
|
|
});
|
|
}
|
|
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', loadSupportCtaModule);
|
|
} else {
|
|
loadSupportCtaModule();
|
|
}
|
|
})();
|