document.addEventListener('DOMContentLoaded', function () { const urlParams = new URLSearchParams(window.location.search); const status = urlParams.get('status'); if (status) { let message = ''; let type = 'success'; if (status === 'success') { message = 'Thank you for your message! We will get back to you shortly.'; } else if (status === 'error') { message = 'Something went wrong. Please try again.'; type = 'danger'; } if (message) { const toastContainer = document.getElementById('toast-container'); const toastHTML = ` `; toastContainer.innerHTML = toastHTML; const toastElement = toastContainer.querySelector('.toast'); const toast = new bootstrap.Toast(toastElement, { delay: 5000 }); toast.show(); } // Clean the URL window.history.replaceState({}, document.title, window.location.pathname); } });