K
K
Kirill Gorelov2017-02-22 14:48:13
PHP
Kirill Gorelov, 2017-02-22 14:48:13

Get array in js via ajax?

Hi guys.
A question.
There is a statistic.php page where I output an array in json

{"col_day":"525","day_budjet":"3906060","col_mount":"525","day_budjet_mount":"3906060"}

I need to get this array through and output, but do it all through js.
I pull it up through ajax, but I get not an array that can be parsed through JSON.parser, but a regular string.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2017-02-22
@MadridianFox

JSON.parser takes a string and makes an object/array out of it, in your case it's an object.
If you use jQuery to perform ajax requests, then it will be enough to specify dataType: "json" and the result will immediately be in the form of an object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question