D
D
david25552018-04-09 09:54:45
JavaScript
david2555, 2018-04-09 09:54:45

How to get an array via json parse?

Hello, please tell me how to get data from php through json parse
, I have this code. how can i get an array?

$proigr = array(
           'z_1'=>0,
           'z_2'=>rand(0, 1),
           'z_3'=>rand(0, 1),
           'z_4'=>rand(0, 1),
           'z_5'=>rand(0, 1),
           'z_6'=>rand(0, 1),
           'z_7'=>rand(0, 1),
           'z_8'=>rand(0, 1),
           'z_9'=>rand(0, 1),
        );
        echo json_encode($proigr);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Pavlov, 2018-04-09
@david2555

1) Put die; at the end, so as not to give away anything superfluous.
2) Make an ajax request to the url where the code above is available.
3) Work with the server response.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question