Store无法得到后台返回的数据,直接输入后台地址是可以得到数据的。忙了5天都弄不出来,请大家帮帮忙。网页aa.html的代码如下<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>Ajax + CGI Test</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
var cum = new Ext.grid.ColumnModel([
{header:'ID',dataIndex:'id'},
{header:'adValue',dataIndex:'adValue'},
{header:'adTime',dataIndex:'adTime'}
]);
var store = new Ext.data.Store({
autoLoad:true,
fields:['id','adValue','adTime'],
proxy:new Ext.data.HttpProxy ({url:'showAll.cgi'}),
reader:new Ext.data.JsonReader({totalProperty:'totalProperty',root:'root'},[{name:'id'},{name:'adValue'},{name:'adTime'}])
});//问题是这个Store得不到showAll.cgi返回的数据,
var cumgrid = new Ext.grid.GridPanel({
renderTo:'cumGrid',
store:store,
stripeRows:true,
viewConfig:{
forceFit:true
},
autoHeight:true,
autoWidth:true,
cm:cum,
bbar:new Ext.PagingToolbar({
pageSize:10,
autowidth:true, 
store:store,
displayInfo:true,
emptyMsg:'no record'
})
});
//store.load();
cumgrid.render();
});
</script>
</head> <body>
<dev id ="cumGrid"></div>
</body>
</html>
直接访问showAll.cgi返回的数据是这样的
{totalProperty:20,root:[{id:'1',adValue:'408 ',adTime:'2012-07-23 19:24:01'},{id:'2',adValue:'408 ',adTime:'2012-07-23 19:24:01'},{id:'3',adValue:'408 ',adTime:'2012-07-23 19:24:02'},{id:'4',adValue:'408 ',adTime:'2012-07-23 19:24:02'},{id:'5',adValue:'408 ',adTime:'2012-07-23 19:24:03'},{id:'6',adValue:'407 ',adTime:'2012-07-23 19:24:03'},{id:'7',adValue:'407 ',adTime:'2012-07-23 19:24:04'},{id:'8',adValue:'407 ',adTime:'2012-07-23 19:24:04'},{id:'9',adValue:'408 ',adTime:'2012-07-23 19:24:05'},{id:'10',adValue:'407 ',adTime:'2012-07-23 19:24:05'},{id:'11',adValue:'407 ',adTime:'2012-07-23 19:24:06'},{id:'12',adValue:'407 ',adTime:'2012-07-23 19:24:06'},{id:'13',adValue:'406 ',adTime:'2012-07-23 19:24:07'},{id:'14',adValue:'407 ',adTime:'2012-07-23 19:24:07'},{id:'15',adValue:'406 ',adTime:'2012-07-23 19:24:08'},{id:'16',adValue:'408 ',adTime:'2012-07-23 19:24:08'},{id:'17',adValue:'407 ',adTime:'2012-07-23 19:24:09'},{id:'18',adValue:'408 ',adTime:'2012-07-23 19:24:09'},{id:'19',adValue:'406 ',adTime:'2012-07-23 19:24:10'},{id:'20',adValue:'405 ',adTime:'2012-07-23 19:24:10'}]}