0

Im new to web development, and I have setup my postman and it makes successful POST calls to the appropriate link, I am trying to replicate this in javascript, but I wasn't sure what I would use, do I use fetch, $.ajax or XMLHttpRequest. Postman is sending a Body aswell with values one of them being an uploaded file, and some header values one of the header values being Content-Type: "multipart/form-data", I assume I should be sending them as well, but I am not sure what the syntax or format would be. Currently I keep getting error 400 or sometimes error 412.

idk
  • 11
  • 2
  • Use fetch. See https://stackoverflow.com/questions/35549547/fetch-api-vs-xmlhttprequest and https://stackoverflow.com/questions/52261136/difference-between-fetch-ajax-and-xhr. – jarmod Jul 21 '22 at 19:52
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jul 22 '22 at 05:31

0 Answers0