// Add event listener to button document.getElementById("ssl").addEventListener("click", function () { getSSL(); }); // Add enter key listener to input document.getElementById("domain").addEventListener("keyup", function (event) { if (event.key === "Enter") { getSSL(); } }); function getSSL() { // Get the input value const domain = document.getElementById("domain").value; // Set the domain parameter const params = new URLSearchParams(); params.append("domain", domain); // Add the parameters to the URL const url = `/?${params.toString()}`; // Push the URL to the history history.pushState(null, null, url); // Add a loading spinner document.getElementById("results").innerHTML = `
${data.message}
`; } }) .catch(error => { // Display an error message document.getElementById("results").innerHTML = `${error.message}
`; }); } // On load check if params are present if (window.location.search) { const params = new URLSearchParams(window.location.search); const domain = params.get('domain'); if (domain) { // Add domain to input document.getElementById("domain").value = domain; getSSL(domain); } }