1👍
✅
It seems to me that your issue is that you are trying to send a whole object instead of JSON. The correct way to do this would be to use http.send(JSON.stringify(params))
1👍
You should use one of three ways to do it
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#A_brief_introduction_to_the_submit_methods
Or either, you can take Axios.
1👍
You can use the new fetch API for this, makes it dead easy and less code
// Call the fetch function passing the url of the API as a parameter
fetch(url)
.then(function(response) {
// Your code for handling the data you get from the API
})
.catch(function() {
// This is where you run code if the server returns any errors
});
Also if your a newbie it will get things working quicker and help you solve your problem faster.
Source:stackexchange.com