DEV Community

Discussion on: Huge problem: code does not go further than await

Collapse
r0bnet profile image
rob • Edited on

You have to await Q and then execute .json() on the result. fetch() returns a promise that can be awaited.

Would probably go for something like:

 let Q = await fetch('/ajax/get', {
  method: 'POST',
  body: FD
});
let data = await Q.json();

Read 4th parahraph under Concepts and usage:
developer.mozilla.org/en-US/docs/W...

Collapse
dieldore profile image
Dieldore Author

Thank you, just noticed. In a hurry forgot to specify await