monkeytooth Posted May 14, 2011 Share Posted May 14, 2011 Im trying to do this via native javascript without library help if I can... here is the JSON (its valid): {"figures":[["10","Other"],["45","Operations"],["78","Engineering"],["39","Admin"],["48","PG&WS"],["40","Government"],["2","Power"],["81","Thrust"],["10","Foreign"]],"totalRows":9} all I want to do is alert the "totalRows" specificly. Example: var displayJSON = $('textarea#chartJSON').val(); alert('totalRows: '+displayJSON.totalRows); However the result is coming up as invalid "undefined" more specifically. The variable itself "displayJSON" will display the above JSON string. Right now I have the string rendering in a textarea when the page loads via PHP. So I am wondering if I am approaching it the right way. Or if for some reason storing it in the textarea first then getting that textarea's value is just giving the wrong string type and it cant read as json. Maybe I am just wrong about native support with JSON in JavaScript. Should I just use jquery (since I already am) and go with the parseJSON() function? Quote Link to comment https://forums.phpfreaks.com/topic/236407-json-issue/ Share on other sites More sharing options...
monkeytooth Posted May 14, 2011 Author Share Posted May 14, 2011 never mind.. i opted to go with the parseJSON via jQuery.. I often forget how slow any help comes on the JavaScript board here. To any considering the helping of me I appreciate it.. Quote Link to comment https://forums.phpfreaks.com/topic/236407-json-issue/#findComment-1215418 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.