PDA

View Full Version : async request with EXT



humpdi
29 Mar 2007, 10:16 AM
hey guys!

is there a function in EXT for an ajax-request like the yui

YAHOO.util.Connect.asyncRequest??

thanks

humpdi
29 Mar 2007, 10:23 AM
or did i have get something wrong, and this function IS implemented in EXT ???
looks like this..

tryanDLS
29 Mar 2007, 10:34 AM
Ext.Connection wraps the functionality of the YAHOO code.

humpdi
30 Mar 2007, 3:34 AM
and where can i get the correct syntax how to call Ext.Connect???

tryanDLS
30 Mar 2007, 8:07 AM
HttpProxy calls Connect to make a web request. Or, look at the source for Connect - it's pretty simple.

seldon
4 Apr 2007, 2:50 AM
Hmm, but then Ext.data.Connection.request(..) doesnt work. Should i instantiate this class first before using it? Then the yahoo.util.connect.asyncrequest is one line shorter ?

soad
4 Apr 2007, 3:26 AM
I'm using Ext.lib.Ajax.request() to make asynchronous Ajax requests.




var success = function (o)
{
// Success callback
// o is an instance of XMLHTTPRequest
}.createDelegate(this);

var failure = function (o)
{
// Failure callback
}.createDelegate(this);

var url = 'someurl.php';
var params = {
'param1': 'value1',
'param2': 'value2',
'paramN': 'valueN'
};
params = Ext.urlEncode(params);

Ext.lib.Ajax.request('POST', url, {success: success, failure: failure}, params);


Hope this helps.

seldon
4 Apr 2007, 3:44 AM
Yeps thats the same as calling the YAHOO.util.Connect.asyncrequest directly and does not involve a Ext.Connection object. Hence my intercepting of the handleresponse of the connection object has no result in that case. So then still the best way is to instantiate my own connection object and use that for async requests? (if i want to be able to intercept all requests?)

tryanDLS
4 Apr 2007, 9:12 AM
Yes. Look at how HttpProxy creates a new Connection object. You should be able to trace thru this entire process by looking at any example that creates a Store object and the associated HttpProxy.