This is what I have:
Polymer('my-element', {
created: function() {
this.data = {
name: 'John Doe',
email: '[email protected]'
};
},
handleResponse: function(e, d) {
console.log(d.response);
}
});
<core-ajax
id="ajax"
auto
url="/test"
method="POST"
handleAs="json"
body="{{data}}"
on-core-response="{{handleResponse"}}>
</core-ajax>
And I have a server set up to return the body of the POST message when the user posts to /test.
app.post('/test', function(req, res) {
res.json(req.body);
}
However, this is what I get as response on the console:
Object {object Object: ""}
core ajax all data you want to get with post must be sent with params attribute not body attribute.
that would make your core ajax tag look like
that would allow you to catch the data like normal in node
it is confusing cause in node you think of params as get data and body as post data but this doesn't matter with core ajax. all data get or post is sent with the params attribute.