我是Sencha的新人 我创造了
var genres = new Ext.data.Store({ autoLoad: true,
proxy: {
url: '../www/App/stores/genres.php'
,callbackKey: "callback"
, type:'ajax',
reader:{
type:'json',
root:'rows'
},
callback:function(data){
alert(data);}
},
fields:[{name:'ii',type: 'int'},{name:'genre_name',type:'string' }]
});
php文件创建json文件,但如果我创建json文件,我无法访问它们而不是它可以正常工作?帮助
答案 0 :(得分:0)
你是否在php服务器上正确实现了回调?像这样:
$callback = $_REQUEST['callback'];
// Create the output object.
$output = array('a' => 'Apple', 'b' => 'Banana');
//start output
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '(' . json_encode($output) . ');';
} else {
header('Content-Type: application/x-json');
echo json_encode($output);
}