scan networks
This commit is contained in:
parent
2a902ed416
commit
70b4195bf0
@ -3317,3 +3317,31 @@ function sendNetworkToSSID(element) {
|
||||
ssid_input.value = value;
|
||||
element.classList.add("active");
|
||||
}
|
||||
|
||||
|
||||
// scan nearby networks
|
||||
function scanNetworks() {
|
||||
var networksListReset = document.getElementById("networks-list");
|
||||
networksListReset.innerHTML = "";
|
||||
fetch("/scanNetworks", {
|
||||
method: "PUT",
|
||||
})
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
// Parse the response data as JSON
|
||||
var networks = JSON.parse(data);
|
||||
|
||||
// Iterate over the networks object and create list items
|
||||
for (var ssid in networks) {
|
||||
var listItem = document.createElement("li");
|
||||
listItem.textContent = ssid;
|
||||
listItem.onclick = function() {
|
||||
sendNetworkToSSID(this);
|
||||
};
|
||||
networksListReset.appendChild(listItem);
|
||||
}
|
||||
})
|
||||
.catch(error => console.log(error));
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user