/** * pricing.js * * Powers the Pricing page. * * Features: * - Loads the three plan definitions from `./data/pricing.json` * asynchronously via fetch(). * - Dynamically renders one card per plan, highlighting the * "featured" plan with a coloured border and a "Most popular" * badge. * - Shows a graceful error message if the JSON file cannot be * loaded. * * Keeping plan data in a separate JSON file means marketing copy and * prices can be updated without touching the page markup. */ const pricingContainer = document.getElementById('pricingContainer'); async function loadPricing() { try { const response = await fetch('./data/pricing.json'); if (!response.ok) { throw new Error(`Failed to load pricing: ${response.status}`); } const data = await response.json(); renderPlans(data.plans); } catch (error) { console.error('Error:', error); pricingContainer.innerHTML = `
Unable to load pricing. Please try again later.
`; } } function renderPlans(plans) { pricingContainer.innerHTML = ''; plans.forEach(plan => { const col = document.createElement('div'); col.className = 'col-12 col-md-4 mb-4'; const featuresHtml = plan.features .map(f => `