我在Windows上使用ExtJs 4.2.2,我愿意执行python脚本来加载我的json数据。 我正在按照文档中的示例进行操作,我遇到了一个我无法理解的错误:我的商店似乎没有执行我的python脚本来获取响应,而是尝试将我的源代码加载为json文件
test.py:
#!C:\Python27\python.exe
import json
print "Content-type: application/json\n\n"
print("{\"text\":\".\",\"UserStories\":[{\"id\": \"1\", \"State\":\"hello\", \"headline\": \"world\", \"category\": \"rien\"}]}")
我的商店TreeGrid.js:
Ext.define
(
'CMS.store.TreeGrid',
{
extend: 'Ext.data.TreeStore',
model: 'CMS.model.TreeGrid',
storeId: 'TreeGrid',
autoLoad: false,
autoSync: true,
proxy:
{
type: 'ajax',
url: 'pythonScripts/test.py',
reader:
{
type: 'json',
root: 'UserStories'
},
},
folderSort: true
}
);
我的控制器中的功能:
onRequest: function()
{
var myStore = this.getTreeGridStore();
myStore.load
(
{
scope: this
}
);
Ext.Ajax.request
(
{
url: 'pythonScripts/test.py',
success: function(response, opts)
{
var obj = Ext.decode(response.responseText);
console.dir(obj);
},
failure: function(response, opts)
{
console.dir('server-side failure with status code ' + response.status);
}
}
);
}
以下是我对FireBug的回应: http://www.sencha.com/forum/attachment.php?attachmentid=46630&d=1383130677
我无法理解为什么它没有执行脚本但是试图获取原始代码。 任何帮助将不胜感激,谢谢。