JSON结构我使用laravel并在数据库中存储一个JSON字符串:存储和获取数据库
[{label: 'Introduction',id: 'ABC'},{label: 'Chapter one',id: 'DEF'}]
我想使用的角度来得到这个字符串,并以一个jQuery插件树用它。我似乎无法正确检索字符串。它总是在控制台中出现undefined
。我错过了什么?
DB查询:
DB::table('documents')->where('id',Input::json('id'))->get(array('structure'));
角控制器:
TopicService.load($scope.publication).success(function(data) {
$('#topics').tree({
data: data.structure
});
});
什么是数据内容。 console.log(data) – ArtisticPhoenix 2014-11-09 01:58:05
@ArtisiticPhoenix一个像这样的对象'structure:“[{label:'Introduction',id:'ABC']},{label:'Chapter one',id:'DEF']}]” ' – greener 2014-11-09 02:01:54
- 那是.tree()期望的?显然它不是未定义的,你的问题有点含糊 – ArtisticPhoenix 2014-11-09 02:04:34