Ildarmustafin86
Active member
HTML:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Proba</title>
<meta name="generator" content="WYSIWYG Web Builder 16 - http://www.wysiwygwebbuilder.com">
</head>
<script>
document.getElementById("Button1").addEventListener("click", function(event){
event.preventDefault();
let chk = (document.getElementById("Checkbox1").checked)?1:0;
let jsonData = 'chkbox1=' + chk;
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
Console.log("Success");
}
};
xhttp.open("GET", 'isChecked?'+jsonData, true);
xhttp.timeout = 10000;
xhttp.send();
});
</script>
<body>
<div id="wb_Checkbox1" style="position:absolute;left:280px;top:161px;width:98px;height:44px;z-index:0;">
<input type="checkbox" id="Checkbox1" name="" value="on" checked style="position:absolute;left:0;top:0;"><label for="Checkbox1"></label>
</div>
<input type="text" id="Editbox1" style="position:absolute;left:255px;top:113px;width:139px;height:27px;z-index:1;" name="Editbox1" value="" spellcheck="false">
<link href="Безымянный1.css" rel="stylesheet">
<link href="index.css" rel="stylesheet">
</body>
</html>
C:
server.on("/isChecked", HTTP_GET, [](AsyncWebServerRequest * request) {
int chkbox1= request->arg("chkbox1").toInt();
request->send(200, "text/plain", "");
});
p.s Кнопку Button1 добавьте