D
D
david25552018-04-06 19:27:00
JavaScript
david2555, 2018-04-06 19:27:00

How to get data via json?

hello i have this php code

$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);

I want to get data in json format via ajax, please provide some simple example, not necessarily for my php code, just to make it clear

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Archakov Dennis, 2018-04-06
@archakov06

So you seem to be doing everything right. So you need to convert the array to JSON.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question