json loading works now---> now to css
This commit is contained in:
parent
72fcf9d732
commit
6c1a8d155f
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Read JSON Lines</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Read JSON Lines</h1>
|
||||||
|
<ul id="jsonLines"></ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
fetch('/igate_conf.json')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
const jsonLines = document.getElementById('jsonLines');
|
||||||
|
data.forEach(line => {
|
||||||
|
const listItem = document.createElement('li');
|
||||||
|
listItem.textContent = line;
|
||||||
|
jsonLines.appendChild(listItem);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error reading JSON:', error));
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -280,15 +280,24 @@ void startServer() {
|
||||||
request->send(SPIFFS, "/index3.html", "text/html");
|
request->send(SPIFFS, "/index3.html", "text/html");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.on("/test4", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||||
|
request->send(SPIFFS, "/index4.html", "text/html");
|
||||||
|
});
|
||||||
|
|
||||||
server.on("/testx", HTTP_GET, [](AsyncWebServerRequest *request) {
|
server.on("/testx", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||||
request->send(SPIFFS, "/testx.html", "text/html");//"application/json");
|
request->send(SPIFFS, "/testx.html", "text/html");//"application/json");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//setDefaultFile("testx.html");
|
||||||
|
|
||||||
if (Config.ota.username != "" && Config.ota.password != "") {
|
if (Config.ota.username != "" && Config.ota.password != "") {
|
||||||
AsyncElegantOTA.begin(&server, Config.ota.username.c_str(), Config.ota.password.c_str());
|
AsyncElegantOTA.begin(&server, Config.ota.username.c_str(), Config.ota.password.c_str());
|
||||||
} else {
|
} else {
|
||||||
AsyncElegantOTA.begin(&server);
|
AsyncElegantOTA.begin(&server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server.serveStatic("/", SPIFFS, "/");
|
||||||
|
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("init : OTA Server ... done!");
|
Serial.println("init : OTA Server ... done!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue