       String newhostname = server.arg("name");// = request->getParam("name")->value();
       WiFi.hostname(newhostname);
       MDNS.begin(newhostname.c_str());
-      //Serial.println(newhostname);
       server.send(200, "text/plain", newhostname);
     });
 
-    server.on("/wifi/scan", HTTP_GET, []() {
-
+    server.on("/wifi/scan", []() {
       String scanResp = "";
+      tot = WiFi.scanNetworks();
+
       if (tot == 0) {
         server.send(200, "text/plain", "No networks found");
       }

      }

      scanResp += "{\"result\": { \"APs\" : [ ";
      //Serial.println("scan2");
      //ETS_SPI_INTR_DISABLE();
      for (int netIndex = 0; netIndex < tot; netIndex++) {
        scanResp += "{\"enc\" : \"";

      break;
    case 3:
      mode = "AP+STA";
      break;
    case 4:
      mode = "----";
      break;
    default:
      break;
  }
  return mode;
