jsonObject.list["com.beans.ComplaintDO"]["first__name"]
Not related to struts in anyway btw.
musachy
On Tue, Aug 5, 2008 at 5:09 PM, sharath karnati <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm getting below value in req.responseText
>
>
> {"list":{"com.beans.ComplaintDO":{"first__name":"Sharath","last__name":"Karnati"}}}
>
> which I'm passing for JSON
>
> jsonObject=eval( "("+ req.responseText +")" );
>
> How to read 'first__name' value from jsonObject?
>
> Thanks,
> Sharath.
>
> --- On Mon, 8/4/08, sharath karnati <[EMAIL PROTECTED]> wrote:
>
> From: sharath karnati <[EMAIL PROTECTED]>
> Subject: Struts2 with JSON.
> To: [email protected]
> Date: Monday, August 4, 2008, 10:25 AM
>
> Hi All,
>
> Using JSON, I'm getting below response from action
>
>
> {"list":{"com.beans.ComplaintDO":{"user__complaint__number":"08-C00000153","user__complaint__key":"08-C00000153-1","form__type":"2000B","first__name":"Sharath","last__name":"Karnati"}}}
>
> In this response, 'com.beans.ComplaintDO' is a javabean.
> 'list' is a java arraylist and it may contain multiple
> 'com.beans.ComplaintDO' javabeans.
>
> I'd like to know how to read this response in java script, I tried below
> way but getting java script error(jsonObject has no properties)
>
> function onReadyState()
> {
> alert('In onReadyState');
> var ready=req.readyState;
> var jsonObject=null;
>
> if ( ready == READY_STATE_COMPLETE )
> {
> jsonObject=eval( req.responseText );
> var searchresults = jsonObject.ComplaintDO.entry;
> alert('In searchresults:'+searchresults.length);
> }
> }
>
> Please let me know how to read these values from json object.
>
> Thanks,
> Sharath.
>
>
>
>
>
>
>
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]