40 lines
1.1 KiB
HTML
40 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Formulaire César</title>
|
|
<script type="text/javascript">
|
|
var httpRequest;
|
|
function requeteHTTP(i) {
|
|
if (i === "") return false;
|
|
httpRequest = new XMLHttpRequest();
|
|
httpRequest.onreadystatechange = () => {
|
|
accuseReception(httpRequest);
|
|
};
|
|
httpRequest.open('GET', "http://localhost:8080/allcesar?val=" + i, true);
|
|
httpRequest.setRequestHeader("Content-Type", "application/json");
|
|
httpRequest.send();
|
|
}
|
|
|
|
function accuseReception(httpRequest) {
|
|
if (httpRequest.readyState == XMLHttpRequest.DONE) {
|
|
if (httpRequest.status == 200) {
|
|
console.log(httpRequest.responseText);
|
|
document.getElementById("resultat").innerHTML = httpRequest.responseText;
|
|
} else {
|
|
console.error('Il y a eu un problème avec la requête.');
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<fieldset>
|
|
<label for="val">Texte à chiffrer :</label>
|
|
<input type="text" id="val" name="val" required><br />
|
|
<br>
|
|
<button onclick="requeteHTTP(document.getElementById('val').value)">Envoyer</button>
|
|
</fieldset>
|
|
<div id="resultat"></div>
|
|
</body>
|
|
</html>
|