php - Storing and getting json structure in database -
i'm using laravel , storing in database json string:
[{label: 'introduction',id: 'abc'},{label: 'chapter one',id: 'def'}]
i string using angular , utilize in jquery tree plugin. don't seem able retrieve string properly. comes out in console undefined
. missing?
db query:
db::table('documents')->where('id',input::json('id'))->get(array('structure'));
angular controller:
topicservice.load($scope.publication).success(function(data) { $('#topics').tree({ data: data.structure }); });
ok likely, based on our conversation in comments, have json string , not json object. can either parsejson
string or send right headers php.
header('content-type: application/json'); //echo json here.
php jquery json angularjs
No comments:
Post a Comment