Код: Выделить всё
var json = {
id: "whatever",
name: "start",
children: [{
"id": "0.9685",
"name": " contents:queue"
}, {
"id": "0.79281",
"name": " contents:mqq_error"
}
}]
}
< /code>
Я помещаю все, что находится в файле {} < /code> в файле content.json < /code> и попытался загрузить это в локальную переменную Javascript, как объяснено здесь: Загрузите json-varible. < /p>
var json = (function() {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': "/content.json",
'dataType': "json",
'success': function(data) {
json = data;
}
});
return json;
})();
Что я пропустил?
Подробнее здесь: https://stackoverflow.com/questions/144 ... o-variable