mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-31 06:46:12 +02:00
Initial partial upload, testing needed
This commit is contained in:
parent
e51267f33c
commit
1203f890f1
7 changed files with 1054 additions and 0 deletions
31
whois/web/script.js
Normal file
31
whois/web/script.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
document.addEventListener("DOMContentLoaded", function() {
|
||||
document.getElementById("whoisForm").addEventListener("submit", function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
var formData = new FormData(this);
|
||||
|
||||
xhr.open("POST", "checkWhois.php", true);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4) {
|
||||
var resultDiv = document.getElementById("result");
|
||||
if (xhr.status === 200) {
|
||||
var data = JSON.parse(xhr.responseText);
|
||||
if (data.error) {
|
||||
resultDiv.innerHTML = '<div class="alert alert-danger">' + data.error + '</div>';
|
||||
} else {
|
||||
resultDiv.innerHTML = '<div class="alert alert-success">' + data.result + '</div>';
|
||||
}
|
||||
} else {
|
||||
resultDiv.innerHTML = '<div class="alert alert-danger">An error occurred. Please try again.</div>';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onloadstart = function() {
|
||||
document.getElementById("result").innerHTML = '<div class="loading">Loading...</div>';
|
||||
};
|
||||
|
||||
xhr.send(formData);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue