NodeJs Express App.
It is necessary to transfer an array from the client to the server.
On the client I form an array:
var path = []; for(var i = 0; i < someObject.lenght; i++) { path.push({ "path_x" : someObject[i].getAttribute("d")}); } I send to the server:
$.ajax({ type: 'POST', url: '/getPaths', data: path, success: function (resp) { alert(resp); }, error: function (xhr, str) { alert('Возникла ошибка: ' + xhr.responseCode); } }); On the server, trying to get an answer: /route/index.js:
var router = express.Router(); router.post('/getPaths',function(req, res, next){ console.log(req.body); res.end(); }); On the server I get a response, something like this:
{ 'undefined': '' } How to transfer an array to the server?
TypeScriptlook here github.com/typestack/routing-controllers - qwabra