Answer the question
In order to leave comments, you need to log in
How to work with json on js?
<?php $file = file_get_contents("http://site.com/my.json");
$json = json_decode($file); ?>
<?php if ($json->vars->var1->active== 1) { ?>
<div>text1</div>
<?} ?>
<?php if ($json->vars->var1->active== 0) { ?>
<div>text2</div>
<?} ?>
Answer the question
In order to leave comments, you need to log in
var file = response; // полученный ответ сервера
var json = JSON.parse(file);
if(json.vars.var1.active == 1)
//..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question