AJAX w/ Ext JS
Needing to retrieve just a simple string from an AJAX call using Ext JS and put it inside of a span, here's what I came up with. I am retrieving a single record from XML generated from a ColdFusion CFC.
function updateName(ValueX) {
if (ValueX) {
Ext.get("SpanX").update("");
Ext.Ajax.request({
url: 'x_gateway.cfc',
params: {method:'getMethodX', name:ValueX},
method: 'POST',
success: updateContent,
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', 'There was an error');
}
});
}
}
function updateContent(result,request) {
var readerX = new Ext.data.XmlReader({record: 'record'},
[{name: 'email'}]);
var resultX = readerX.read(result);
Ext.get("SpanX").update("resultX .records[0].data.email);
}


There are no comments for this entry.
[Add Comment]