I'm facing an issue with my code where I am calling a servlet from JavaScript using an AJAX request. The data from the servlet is shown in a message box within the success function, but it's not being loaded into a variable called `myData` in JavaScript. The data from the servlet is in JSON format. Can someone please help me debug this? Here's the relevant portion of my code:
var myData = null;
Ext.Ajax.request({
url: 'MyDataServlet',
method: 'GET',
loadMask: true,
scope: this,
success:
function ( result, request ) {
Ext.MessageBox.alert('success', result.responseText);
myData = Ext.decode(result.responseText);
console.log(myData);
store.loadData(myData);
},
failure:
function (result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});