Access Javascript Object Property Issue -
i'm having issues accessing properties of simple object. novice programmer suspect have simple misunderstanding of i'm working with.
here code executing:
console.log(content); console.log(content.title); (x in content){ console.log(content[x]) }
and here console response:
{"title":"test","description":"test"} undefined { " t t l e " : " t e s t " , " d e s c r p t o n " : " t e s t " }
any guidance appreciated.
edit
the content object being sent server via angular.js $http service follows:
$http({ method:'post', url:"/create/createcontent", params:{content:$scope.content} }).
it seems service moves data in json format.
thanks help! appreciate it.
this looks content
in fact string , iterating on characters in string. try , see if gives want:
var contentjson = json.parse(content); (var x in contentjson) { console.log(contentjson[x]); }
this parse content
string appropriate javascript object , should able access properties.
Comments
Post a Comment