PDA

View Full Version : Simple text output of JSON store data



squeakingsneaker
25 Feb 2010, 8:50 AM
Hi there,

how can I access the data in a JSON store to get a simple output like tostring() in any language? I would like to inject the data in a bare DIV instead of opening up another panel or gridpanel..

Thanks for any hint.
squeak

manube
25 Feb 2010, 8:59 AM
Hello,
In the following code, you can get the JSON string in the success method by accessing "response.responseText".


Ext.Ajax.request({
url: 'data.json',
params: params
success: function (response)
{
var responseData = Ext.util.JSON.decode(response.responseText);
if(responseData.success)
{/**/}
else
{/**/}
},
failure: requestFailure,
});


Hope it helps

squeakingsneaker
25 Feb 2010, 9:47 AM
Hello manube,

thanks for your reply.
No sorry, I don't understand. I meant any json store with any data and not a json encoded http request. I'm looking for something like:



var store = new Ext.data.JsonStore({ blabla });

document.write(store.toString());
Thanks

manube
26 Feb 2010, 8:22 AM
For debugging, you can use console.log(jsonData) in firefox with firebug add-on, otherwise I don't know.

cheers