-
24 Jan 2012 2:59 AM #1
Unanswered: Retrieving data from .json file
Unanswered: Retrieving data from .json file
Hi,
Can anyone help me with following question
Retrieving data from .json file directly without using store and model?
kindly suggest some solutions
-
24 Jan 2012 3:07 AM #2
Repeat the previous Problem
Repeat the previous Problem
{
success:true,
userTimeZone:'CST',
namevalue:
[
{id:'1',name:'one'},
{id:'2',name:'two'},
{id:'3',name:'three'},
{id:'4',name:'four'}
]
}
The above one is json file
I want to access the value of 'userTimeZone' directly in .js file without using store and model
-
24 Jan 2012 6:30 AM #3
You can use Ext.Ajax.Request() to retrieve the JSON file from server and then use Ext.decode() the JSON string to an object. With your example of JSON file, to retrieve JSON file and access 'userTimeZone':
Code:Ext.Ajax.request({ url: 'url to your JSON file', success: function(response, opts) { var obj = Ext.decode(response.responseText); console.log(obj.userTimeZone); }, failure: function(response, opts) { console.log('server-side failure with status code ' + response.status); } });
-
24 Jan 2012 9:33 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 29
- Answers
- 83
Here is an article i wrote a looooooooong time ago on Ajax: http://www.sencha.com/learn/legacy/Manual:Core:Ext.Ajax

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.


Reply With Quote