Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get value from Ext.Ajax.request

Tags:

extjs

Ext.Ajax.request({
   url:'abc/abc/abc',
   success:  function(response){
      var result = Ext.decode(response.responseText);
      var value=result.roles;
   }
});

How can I get "value=result.roles" from ext.ajax.request?

I am trying to use an action.

Ext.Ajax.request({
   url:'abc/abc/abc',
   success: function(response){
      var result = Ext.decode(response.responseText);
      var value=result.roles;
      getValue(value);                    
   }
});

function getValue(value) {
   return value;
};

But I still can't get the value.

How can I do this?

like image 618
陳同學 Avatar asked Nov 09 '12 11:11

陳同學


1 Answers

You need to use this:

success: function ( result, request ) {
                      var jsonData = Ext.util.JSON.decode(result.responseText);
                      var resultMessage = jsonData.data.result;
                     fn_AKExt(resultMessage, ‘Success’);
               },
failure: function ( result, request ) {
                   var jsonData = Ext.util.JSON.decode(result.responseText);
                  var resultMessage = jsonData.data.result;
                  fn_AKExt(resultMessage, ‘Error’);
}

Check out How To Use Ext.Ajax.Request With Response Text for more details.

like image 79
Praveen Kumar Purushothaman Avatar answered Oct 06 '22 00:10

Praveen Kumar Purushothaman