Replies: 2 comments 6 replies
-
You should have an empty html page .. it's because your 'return OK' ...
|
Beta Was this translation helpful? Give feedback.
-
@PatLub85 The way promises and But why not handle the response in the first But either way, I think this is a better question for a web/javascript forum. What you should do is try and replicate a "demo" version of the code that you run on the device (e.g. use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a question that concerns javascript more than Micropython, but given the context, I don't think a javascript forum can answer it.
I tested the project of turning the LED of an ESP32 as described on https://github.com/donskytech/micropython-web-server-microdot/tree/main.
Thanks to sophiedegran, discussion #13517, the program now works with Microdot v2.
My question is about the fetch() method used in the small javascript program.
I understood that a first .then() returns a promise which resolves into a Response object and that a second .then() returns the data.
What I have problem with is that in this project the response stays in the console and the second .then() doesn't return any data. What does fetch() do in this particular context?
Here are the different simplified but functional codes
main.py
index3.html, I removed the CSS to simplify
and index.js
Thank you for taking the time to provide me with an explanation.
Beta Was this translation helpful? Give feedback.
All reactions