PDA

View Full Version : Ext : 3.X basex.js ajax synch HELP



RiceStraw
4 May 2010, 11:16 PM
hi ,everybody, I receive a question,according to the basex.js , I already realization the sync,but i don't know how to
receive value, herein the code:



var req2=Ext.Ajax.request({
url:"./flat/topTool.action (http://www.extjs.com/forum/%22./flat/topTool.action)",
params:{start:s},
async : false ,
success: function(response, opts) {
alert(response.responseText); //now can get the value ,this is the first
}
});
alert(req2.conn.responseText); //this is the second ,but i don't get value ,i want to get value here for this method


next is the [basex.js] code,i don't know how to update,if my ajax.request is async:false,after XMLHTTPREQUETST.send(),the return XMLHTTPREQUEST OBJECT.CONN is null, i use ie8, please everyone can give me some answer.



makeRequest : function(method, uri, callback, postData, options) {
var o;
if (o = this.getConnectionObject(uri, options)) {
o.options = options;
var r = o.conn;
try {
if (o.status.isError) {
alert("makeRequest error");
throw o.status.error
};
A.activeRequests++;
r.open(method.toUpperCase(), uri, options.async,
options.userId, options.password);

('onreadystatechange' in r)
&& (r.onreadystatechange = this.onStateChange
.createDelegate(this, [o, callback,
'readystate'], 0));
('onload' in r)
&& (r.onload = this.onStateChange.createDelegate(
this, [o, callback, 'load', 4], 0));
('onprogress' in r)
&& (r.onprogress = this.onStateChange
.createDelegate(this, [o, callback,
'progress'], 0));
// IE8/other? evolving timeout callback support
if (callback && callback.timeout) {
('timeout' in r) && (r.timeout = callback.timeout);
('ontimeout' in r)
&& (r.ontimeout = this.abort.createDelegate(
this, [o, callback, true], 0));
('ontimeout' in r) ||
// Timers for syncro calls won't work here, as
// it's a blocking call
(options.async && (this.timeout[o.tId] = window
.setInterval(function() {
A.abort(o, callback, true);
}, callback.timeout)));
}
if (this.useDefaultXhrHeader && !options.xdomain) {
this.defaultHeaders['X-Requested-With']
|| this.initHeader('X-Requested-With',
this.defaultXhrHeader, true);
}
this.setHeaders(o);
if (!this.events
|| this.fireEvent('beforesend', o, method, uri,
callback, postData, options) !== false) {
r.send(postData || null);
}
}
} catch (exr) {
// alert("1");
alert("catch" + exr);
o.status.isError = true;
o.status.error = exr;
}
if (o.status.isError) {
alert("iserror6")
return Ext.apply(o, this.handleTransactionResponse(o,
callback));
}
options.async || this.onStateChange(o, callback, 'load');
return o;




setHeaders : function(o) {
// Some XDomain implementations (IE8) do not support setting headers
if (o.conn && 'setRequestHeader' in o.conn) {
this.defaultHeaders
&& forEach(this.defaultHeaders, function(value, key) {
o.conn.setRequestHeader(key, value);
});
this.headers && forEach(this.headers, function(value, key) {
o.conn.setRequestHeader(key, value);
});
}
this.headers = {};
this.hasHeaders = false;
}

tryanDLS
5 May 2010, 6:47 AM
http://extjs.com/learn/Ext_Forum_Help#How_to_post_code_properly