I checked so many websites and followed their examples, and they all just do the same:
let chr = new XMLHttpRequest();
For some reason I get the above error!
I checked so many websites and followed their examples, and they all just do the same:
let chr = new XMLHttpRequest();
For some reason I get the above error!
Node.js does not come natively with XHR like browsers. Perhaps you should try using the built in http.request.
There is also a node module called xmlhttprequest that you can use which will make your code work without changing much of it.
Welcome to the forum..!
You are getting an error as you are trying to run XMLHttpRequest as an browser style. To run this in nodejs, you need the following package: https://www.npmjs.com/package/xmlhttprequest
Here is the usage that how you can include it in NodeJS. https://www.npmjs.com/package/xmlhttprequest#usage