Five Healthy Habits to Avoid Stress Eating During COVID-19

Leave a Reply

Your email address will not be published. Required fields are marked *

Course Login

Skip to content document.addEventListener('DOMContentLoaded', function () { // Only run on HIM Record single posts if (!document.body.classList.contains('single-him_client_record')) return; const submitBtn = document.getElementById('submit-ai-question'); const questionInput = document.getElementById('ai-question'); const postIdField = document.getElementById('hidden-post-id'); const postId = postIdField ? postIdField.value : 'unknown'; if (submitBtn && questionInput) { submitBtn.addEventListener('click', function () { const question = questionInput.value.trim(); if (!question) return; const loading = document.getElementById('ai-loading'); const responseBox = document.getElementById('ai-response'); const responseText = document.getElementById('ai-response-text'); loading.style.display = 'block'; responseBox.style.display = 'none'; responseBox.style.opacity = 0; fetch('https://hooks.zapier.com/hooks/catch/21429105/2nkr6c1/', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ question: question, postId: postId }) }).then(function () { loading.style.display = 'none'; responseBox.style.display = 'block'; setTimeout(function () { responseBox.style.opacity = 1; }, 50); responseText.innerText = "✅ Question submitted. AI response will appear soon."; }).catch(function (error) { loading.style.display = 'none'; responseBox.style.display = 'block'; responseText.innerText = "❌ Error sending question."; console.error(error); }); }); // Hover styling submitBtn.addEventListener('mouseover', function () { submitBtn.style.backgroundColor = '#4f8a61'; }); submitBtn.addEventListener('mouseout', function () { submitBtn.style.backgroundColor = '#6daa75'; }); } });