Ask coding questions

← Back to all posts
how do you do a POST request in JS
Mathman05 (1)

I've been trying to do a POST request to"+id but it gives me an error "TypeError: Failed to execute 'fetch' on 'Window': Invalid name" I'm trying to use fetch

fetch(""+id, {
  method: 'POST',
  headers: {
    'the board': true
  body: exportT()
}).then((g)=> {})

(the headers aren't needed in this situation if that helps)

Answered by themining72 (49) [earned 5 cycles]
View Answer
themining72 (49)

I don't think spaces are allowed, try changing your code to:
'theboard': true