Good day! The situation is this: I process the form and on its basis I create an Object. Before sending AJAX, I string it with JSON.stringify(data) . Everything's Alright. On the server, I receive the received request through a bunch of modules, without performing any actions on it (I am testing the callbacks). And return back.

When the answer arrives, parse it: JSON.parse(xhr.responseText) , everything seems to be normal. It does not give any errors. However, a string is output to the console. My object, only as a string.

What could be the reason for this behavior?

console output:

 {"delivery":{"adresat":{"lastName":"Иванов","firstName":"Дмитрий","secondName":"Петрович","inn":"111111111","tel":"(044)1234567","email":"jhfejfek@gmail.com"},"client":{"lastName":"Сидорода","firstName":"Мария","secondName":"Николаевна","inn":"2222222222","tel":"(097)1234567","email":"jhsjdj@gmail.com"},"post":{"cod":{"office":"39931ae9-e1c2-11e3-8c4a-0050568002cf","obl":"dcaae3a1-4b33-11e4-ab6d-005056801329","raion":"e4aa4da4-4b33-11e4-ab6d-005056801329","city":"e71815c4-4b33-11e4-ab6d-005056801329"},"text":{"office":"Отделение №1: ул. 1 Мая, 2а","obl":"Харьковская область","raion":"Золочевский р-н","city":"Золочев"}}},"cart":[16,17]} 
  • one
    for example, the server serializes a string - Grundy
  • @Grundy, Good day. And it is possible a little more, but I do not understand ( - Dmytryk
  • 2
    You have a string on the server, and before sending it you serialize it again, so you get a serialized string on the client - Grundy
  • @Grundy, it is. I only did this before sending it to the server. Tin) Thanks for the help. - Dmytryk

0