extjs读取json格式数据的问题
后台获取的数据如下:
{"curAccurateDateStr":"2012-12-25 18:17:44","curDate":"2012-12-25T18:17:44","curDateStr":"2012-12-25"}
请问extjs中如何获取这几个字符串的值(其实我只想获取curDateStr的值)
考虑过用类似以下这种方法,但好像那个root不知道填什么,好像行不通,求高手指导:
var ds = new Ext.data.JsonStore({
url:basePath + "public/getCurDate.action",
method:'POST',
root: 'curDateStr',
fields:['perId','perName','gender','phoneNum','email','position','polAppr','regAddr', 'curAddr','emerContPer','emerRela','emerContNum','emerCurAddr','remark']
});
------解决方案--------------------ext有ajax,用ajax发送请求获取到返回的内容后eval生成json对象就行了,用store干嘛?
Ext.Ajax.request({
url: basePath + "public/getCurDate.action", ///
success: function(response){
var text = response.responseText;
var o=eval('('+text+')');
alert(o.curDateStr)
}
});