I am in Node trying to send a http call to an endpoint. I'm not getting any response, and im certain I have set something up incorrectly. My request worked on postman. Any help woud be awesome!
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
curlUpdate = function curlUpdate() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "www.example.com", false);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send({
FirstName: "john",
LastName: "doe",
MerchantSessionID: "817281271",
DateOfBirth: "12,24,1985",
ProductTypeID: "xxxxxxxxx"
});
console.log(xhr.responseText);
};
sendnot an object. TryJSON.stringifying the object before passing it tosend.