Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] JSON parsing... almost...
- Date: Wed, 18 Aug 2010 22:14:08 +0900
- From: Dave M G <dave@example.com>
- Subject: [tlug] JSON parsing... almost...
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6
TLUG,Sorry to be peppering the list with JSON/Javascript questions, but I'm very close to getting the whole circuit complete.I've got my JSON going up to my PHP server, and I'm pretty sure it's coming back okay. But it seems that I'm not getting it to convert into a Javascript object.Here's the code I'm using: sendString = JSON.stringify(sendData); $.post('jsonhandler.php', {sendJSON: sendString}, checkResult, "json"); function checkResult(json_data_received) { if (json_data_received) { dataObject = JSON.parse(json_data_received);console.log ("This is one of the values in the JSON object: " + dataObject.variable )} }It gets down to the console log, so it's passing the "if(json_data_received)" test.However, Firebug tells me "dataObject.variable is not set".I thought that JSON.parse would structure a Javascript object, with nested values, so that if my JSON had {"variable" : "value"}, then the resulting object would have dataObject.varuable set to "value".Where am I going wrong here? Any advice would be much appreciated. -- Dave M G
- Follow-Ups:
- Re: [tlug] JSON parsing... almost...
- From: Simon Cozens
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Laptop power consumption
- Next by Date: Re: [tlug] Laptop power consumption
- Previous by thread: Re: [tlug] Laptop power consumption
- Next by thread: Re: [tlug] JSON parsing... almost...
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links