ボタンがあり、クリックするとサーバーへの呼び出しがあり、JSON応答が返されます。
このJSON応答には、次のような文字列が含まれます
{
"value": "Success",
"information": {
"firstName": "kei",
"surname": "chan"
}
}
JSONのvalue
フィールドはSUCCESSまたはFAILのいずれかになります。したがって、の場合はsuccess
、別のビューに移動してとを表示する必要がfirstName
ありsurname
ます。
値を渡し、その場合は他のビューに渡す必要がありfirstName
ますlastName
。
senchaTouch / cordovaの値とを渡すにはどうすればよい firstName
ですか?lastName
コード:
ボタン
xtype:'button',
id:'when_button_click',
text:'Send',
ui:'confirm',
コントローラクラス
extend: "Ext.app.Controller",
config: {
refs: {
newNoteBtn: "#when_button_click"
},
control: {
newNoteBtn: {
tap: "onNewNote"
}
}
},
onNewNote: function () {
var values = Ext.getCmp('form').getValues();
console.log("inside onNewNote function");
Ext.Ajax.request({
url: 'http://call.com/the_webservice',
params : values,
failure: function (response) {
var text = response.responseText;
console.log("fail");
}, success: function (response) {
var text = response.responseText;
console.log("success");
}
});
}
// init and launch functions omitted.
});