Alexa Rank Checker
Alexa Rank Checker
// Function to handle form submission
function handleFormSubmission(event) {
event.preventDefault();
// Retrieve the URL input value
var url = document.getElementById("urlInput").value;
// Make an API call to perform Alexa Rank check
// Replace the API_URL with the actual URL of your Alexa Rank check API
var API_URL = "https://api.example.com/alexa-rank-check";
var requestBody = {
url: url
};
fetch(API_URL, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(requestBody)
})
.then(response => response.json())
.then(data => {
// Update the rank result in the HTML
document.getElementById("rankResult").textContent = "Alexa Rank: " + data.rank;
})
.catch(error => {
console.error("Error:", error);
});
}
// Add event listener to the form submission
document.getElementById("alexaForm").addEventListener("submit", handleFormSubmission);