PDA

View Full Version : How to Bind the result of the Ajax Call to the Label



RKenkre
3 May 2016, 5:46 AM
Hi Everyone,

Hope you all are doing good.

I needed little help, I have done one Ajax call in my form, which returns a string. I want to bind this string as a Text of my label.

Code of Ajax call:

myrequest: Ext.Ajax.request({
url: 'outage/ShowBanner',
method: 'POST',
callback: function (success) {
if (success) {
var a = success.callback.arguments[2].responseText;
}
}
}),

Code of Label:

{
xtype: 'label',
bodyStyle: 'background-color: transparent;',
cls: 'x-form-item scroll-left',
text: "",
name: 'lblOutage',
id: 'CDBAdmin.lblOutage'
},

I tried calling a Label in Ajax callback function using its Id but it didn't work, Used following lines:
var Label = Ext.getCmp('CDBAdmin.lblOutage');
Label.setText(a);

Thanks in advance.

Regards,
Rohan

Gary Schlosberg
3 May 2016, 7:43 AM
Duplicate: https://www.sencha.com/forum/showthread.php?310608