Sitemap Submitter
Sitemap Submitter
// Function to handle form submission
function handleFormSubmission(event) {
event.preventDefault();
// Retrieve the sitemap URL input value
var sitemapUrl = document.getElementById("sitemapInput").value;
// Make an API call to submit the sitemap
// Replace the API_URL with the actual URL of your sitemap submission API
var API_URL = "https://api.example.com/sitemap-submission";
var requestBody = {
sitemapUrl: sitemapUrl
};
fetch(API_URL, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(requestBody)
})
.then(response => response.json())
.then(data => {
// Update the submission result in the HTML
document.getElementById("submissionResult").textContent = data.submissionResult;
})
.catch(error => {
console.error("Error:", error);
});
}
// Add event listener to the form submission
document.getElementById("sitemapForm").addEventListener("submit", handleFormSubmission);