2013-07-07 68 views
0

我收到一個錯誤,我無法解決;傳遞額外參數時出錯 - 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"}

回答

0

我還沒有使用JSONP自己(雖然我承認應該),但我敢肯定,你需要有一個回調函數包裝你的結果。

onJsonpBeforeStoreLoad({ 
    'note' : 'hell' 
}) 

請再次檢查我的語法和onJsonpBeforeStoreLoad可能VERRY不是您需要使用的功能名稱,你可以定義自己。

我相信你已經看到這個,但對於任何人沒有:JSONP Example