PDA

View Full Version : How do I get access to the response object from an AjaxProxy?



profunctional
26 Sep 2011, 11:13 AM
I currently use a proxy for a store. The only event for the proxy is "exception", which gives me access to the response.

However, I'm returning a message in the response object, even when no exception is thrown. How do I get access to the response object to do this?

MiamiCoder
28 Sep 2011, 2:08 PM
Use the Ajax class's events.

gut
28 Sep 2011, 9:01 PM
use the afterRequest method like below...


var myAjaxProxy = {
type: 'ajax',
url: 'myUrl',
...,
afterRequest: function(request, success){

if ( success ){

var result = Ext.decode(request.operation.response.responseText);
console.info(result);

}

}

profunctional
29 Sep 2011, 4:43 AM
use the afterRequest method like below...


var myAjaxProxy = {
type: 'ajax',
url: 'myUrl',
...,
afterRequest: function(request, success){

if ( success ){

var result = Ext.decode(request.operation.response.responseText);
console.info(result);

}

}


This was exactly what I needed. Thanks!