1
我正在extjs + Yii中工作。我的客戶端功能在yii中設置,服務器端功能在extjs中。在extjs控制器中我編寫了代碼發送動態生成存儲,設置其代理並使用sync()方法存儲。如何通過extjs的store.sync()方法捕獲數據發送
review:function()
{ var reviewQuestionStore=Ext.create('Balaee.store.qb.QbqnsStore');
proxy=reviewQuestionStore.getProxy();
Ext.apply(proxy.api,{
read:'http://127.0.0.1/s_balaee/Balaee/index.php/QuestionBank/Qbpaper/ReviewQuestionPaper',
create:'http://127.0.0.1/s_balaee/Balaee/index.php/QuestionBank/Qbpaper/ReviewQuestionPaper',
});
Ext.apply(proxy.writer,{
type:'json',
root:'records'
});
Ext.apply(proxy.reader,{
type:'json',
root:'questions'
});
var getdata=this.getLocalvalue();
UserId=getdata.data.userId;
//Using sync method
var check =Ext.create('Balaee.model.qb.QbqnsModel',{
questionPaperNo:Paperno,
userId: UserId,
});
reviewQuestionStore.add(check);
reviewQuestionStore.sync();
}
所以它的工作是正確的。而其發送JSON格式的數據原樣
{"records":{"userId":"5","firstName":"abc","middleName":"","lastName":"","languageId":"","primaryEmail":"[email protected]","birthDate":"","password":"","securityQuestionId":"","securityQuestionAnswer":"","isMale":"","creationTime":"","ipAddress":"","confirmationCode":"","userStatusId":"","question":"","id":null}}
現在,我要趕在警予控制器功能這個數據。我曾試圖原樣
$postData = json_decode(file_get_contents("php://input"), true);
$clientData = $postData['records'];
和訪問我使用$ clientData [「的firstName」]字段。但它不是working.So如何捕捉Yii中的數據是通過ExtJS的的商店同步()方法來發送。
感謝名單先生......它的工作原理... – user1722857 2013-03-15 09:32:12
@ user1722857歡迎您 – 2013-03-15 10:36:09