SEO Audit
SEO Audit
document.getElementById(‘auditForm’).addEventListener(‘submit’, async function(event) {
event.preventDefault();
const url = ‘https://seo1-436011.lm.r.appspot.com’; // URL del backend
const formData = new FormData(event.target);
const data = Object.fromEntries(formData);
try {
const response = await fetch(url, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
},
body: JSON.stringify(data),
});
if (!response.ok) {
throw new Error(‘Network response was not ok’);
}
const result = await response.json();
document.getElementById(‘results’).textContent = JSON.stringify(result, null, 2);
} catch (error) {
console.error(‘Error performing audit:’, error);
document.getElementById(‘results’).textContent = ‘Error performing audit’;
}
});