document.addEventListener('DOMContentLoaded', function() {
// Remove elements if they exist (equivalent to jQuery removal)
const scriptCodeJS = document.getElementById('scriptCodeJS');
if (scriptCodeJS) scriptCodeJS.remove();
const scriptCodeJQuery = document.getElementById('scriptCodeJQuery');
if (scriptCodeJQuery) scriptCodeJQuery.remove();
const base64encode = document.getElementById('base64encode');
if (base64encode) base64encode.remove();
// Fetch country data using pure JavaScript (fetch API)
let country = null;
fetch('https://pagelink.vetibility.com/get-location')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
country = data.country_name;
const pricingImgs = document.querySelectorAll('img.pricing');
if (!pricingImgs.length) {
console.warn('No elements found with class "pricing"');
return;
}
if (country === 'Canada') {
pricingImgs.forEach(img => {
img.src = 'https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/173bdc7f-bcdc-42da-9d64-534718c12333/vetibility_appt_%2410.png';
});
} else if (country === 'United States of America') {
pricingImgs.forEach(img => {
img.src = 'https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/1f134eb8-1fbb-4337-9007-0b9eda13da53/vetibility_appt_%2420.png';
});
} else {
pricingImgs.forEach(img => {
img.src = 'https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/c51d59f9-13d3-42f4-b2ac-d5233c447ce0/vetibility_appt.png';
});
}
})
.catch(error => {
console.error('Error fetching location:', error);
// Optionally set a default image on error
const pricingImgs = document.querySelectorAll('img.pricing');
pricingImgs.forEach(img => {
img.src = 'https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/c51d59f9-13d3-42f4-b2ac-d5233c447ce0/vetibility_appt.png';
});
});
});
$(document).ready(function() {
$('#scriptCodeJS').remove();
$('#scriptCodeJQuery').remove();
$('#base64encode').remove();
var country = null;
$.get( "https://pagelink.vetibility.com/get-location", function( data ) {
//alert( "Data Loaded: " + JSON.stringify(data) );
country = data.country_name;
if(country == 'Canada') {
$("img.pricing").attr("src","https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/173bdc7f-bcdc-42da-9d64-534718c12333/vetibility_appt_%2410.png");
//https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/6b668804-3ae8-45fc-9ba4-ac7843ccb0ce/vetibility_appt.png
//https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/c51d59f9-13d3-42f4-b2ac-d5233c447ce0/vetibility_appt.png
//https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/173bdc7f-bcdc-42da-9d64-534718c12333/vetibility_appt_%2410.png
} else if (country == 'United States of America') {
$("img.pricing").attr("src","https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/1f134eb8-1fbb-4337-9007-0b9eda13da53/vetibility_appt_%2420.png");
//https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/1f134eb8-1fbb-4337-9007-0b9eda13da53/vetibility_appt_%2420.png
//https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/3e280a9d-d931-44dc-b1c1-0b4fa5fa35f5/vetibility_appt_%2420.png
} else {
$("img.pricing").attr("src","https://images.squarespace-cdn.com/content/v1/620dd212ccbb0c595d67f4dd/c51d59f9-13d3-42f4-b2ac-d5233c447ce0/vetibility_appt.png");
}
//alert(country);
}).fail(function(error) {
//alert(JSON.stringify(error));
});
});
https://www.base64encode.org