传递额外参数时出错 - BEGINNER
问题描述:
我收到一个错误,我无法解决;传递额外参数时出错 - BEGINNER
的错误:Unable to load data using the supplied configuration. Open in Browser: http://localhost/app/p/name.php
Ext.define('MyApp.store.MyJsonPStore1', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.myModel'
],
config: {
autoLoad: true,
model: 'MyApp.model.myModel',
storeId: 'MyJsonPStore1',
proxy: {
type: 'jsonp',
url: 'http://localhost/app/p/name.php',
reader: {
type: 'json'
}
},
listeners: [
{
fn: 'onJsonpstoreBeforeLoad',
event: 'beforeload'
}
]
},
onJsonpstoreBeforeLoad: function(store, operation, eOpts) {
store.load({
params: {note: 'HELLO'}
});
}
});
从什么返回http://localhost/app/p/name.php
是{"note":"Hell"}
答
我还没有使用JSONP自己(虽然我承认应该),但我敢肯定,你需要有一个回调函数包装你的结果。
即
onJsonpBeforeStoreLoad({
'note' : 'hell'
})
请再次检查我的语法和onJsonpBeforeStoreLoad可能VERRY不是您需要使用的功能名称,你可以定义自己。
我相信你已经看到这个,但对于任何人没有:JSONP Example