I'm using ExtJs 4.2.2 on Windows and I'm willing to execute a python script to load my json data. I'm following the example in the documentation and I'm facing an error I can't understand : my store doesn't seem to execute my python script to get a response, instead it tries to load my source code as a json file.
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\"}]}")
my store 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
}
);
the function in my controller :
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);
}
}
);
}
And here is the response I get on FireBug: http://www.sencha.com/forum/attachment.php?attachmentid=46630&d=1383130677
I just can't get why it's not executing the script but tries to get the raw code in it. Any help would be appreciated, thank you.