S
S
Shyngys Sailaubai2018-03-13 18:33:21
JavaScript
Shyngys Sailaubai, 2018-03-13 18:33:21

Why doesn't Jquery parse JSON array?

Good day. Please write what could be causing the problem.
I am on 127.0.0.1. Php returns encoded json array. I get the array through $.getJSON and do the parsing, everything works until the Content-type: application / json is set in the response header. After that, jQuery stops seeing the response from the server as an object, it processes it as a string.
If sent with the usual Content-type:text/html $.each() header, everything works fine.
And I also noticed: When the title is set as json, then it is written to the console as a string, and when it is text/html, then the response is written to the console as an object.
Of course, the problem is not critical, but I would like json to be given with the application/json header

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2018-03-22
@iCoderXXI

Generally nothing question. Where would you put the code, yes, the JSON that you give, and the headers that fly away from the puff, and so what is called telepaths on indefinite leave ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question