PDA

View Full Version : What to use instead of new Ajax.Request(...



franzisk
5 Jun 2007, 8:33 AM
What is the similar in Ext to Prototype new Ajax.Request(...) ?

I am still a bit lost here.

I need a loop in a Grid and for each line I need an email sent to user.

Now I have this:

new Ajax.Request('action_setMessages.php',{
parameters:arg,
method:'post',
onSuccess:function(t){
var ret = t.responseText;
},
onFailure:function(t){
alert('Error: '+t.status + ' - ' + t.statusText);
}
});
Thanks

dnixon
5 Jun 2007, 9:28 AM
I'm far from expert on this - but I'm groping around the same area trying to do something when AJAX responses (success/fail) come back. I don't think the API exposes this currently in 1.0.1a.
Maybe you can extend HttpProxy to provide a custom load function that adds a call to your email routine with a copy of the new data. Alternately Store has a bunch of events for various data conditions and you can add a listener to those.

Dave

Following up - this changed in 1.1beta1 - see http://extjs.com/forum/showthread.php?t=6176

tryanDLS
5 Jun 2007, 10:29 AM
Did you look at the Ext.data.Connection class? That's what called internally by HttpProxy. That could is pretty straight forward and documented. The doc in 1.1beta1 may have been updated further. 1.1 also exposes a new Ext.Ajax wrapper around Connection.

franzisk
5 Jun 2007, 10:37 AM
I'll check it ou. Thanks

Animal
6 Jun 2007, 12:30 AM
In 1.1, Ajax is a singleton object with request as a method. It's very easy to use:

http://extjs.com/deploy/ext-1.1-beta1/docs/output/Ext.Ajax.html#request