Product Updates
Waiting for Quote
Thanks for submitting your details. We’re preparing your quote — you’ll be redirected shortly.”
<script>
// 1. Get the customer reference from the URL
const urlParams = new URLSearchParams(window.location.search);
const customerRef = urlParams.get('customerRef');
if (customerRef) {
// 2. Set up a polling interval
const checkUrl = `https://www.architectme.co.uk/wp-json/custom/v1/get-redirect-url?customerRef=${customerRef}`;
const intervalId = setInterval(() => {
fetch(checkUrl)
.then(response => response.json())
.then(data => {
if (data.success && data.url) {
// 3. If a URL is found, redirect the user
clearInterval(intervalId); // Stop polling
window.location.href = data.url;
}
})
.catch(error => {
// Log errors but keep trying
console.error('Error fetching URL:', error);
});
}, 3000); // Poll every 3 seconds
} else {
console.error('Customer reference not found in URL.');
}
</script>