I'm trying to make an HTTP POST request without using jquery because I don't want my client to load jquery just for 1 HTTP request, I know that jquery is not that big, but still, I would like to know what I'm doing wrong here...
my server is in nodejs and is using body-parser, I thought that this might be the cause of my error...
app.js
var xhr = new XMLHttpRequest();
xhr.open("POST", "localhost:8080/test", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify(myObject));
also, is there a way to remove json.stringify since I'm using body-parser?
via MathieuAuclair
No comments:
Post a Comment