来源http://www.akbkhome.com/blog.php/View/137/Developing_with_Extjs__tricks_and_tips.html
[b]接触Extjs's XMLHttpRequest 调用[/b]
Extjs's XMLHttpRequest 可以取代传统德XMLHttp来调用远程服务
例如:
dialog.el.mask("Saving...");
var con = new Ext.data.Connection();
con.request({
url: baseURL + "/mypage.txt", // where to post to..
params: params, // << key value object with data to send
method: 'POST',
callback: function(opts, success, response) {
dialog.el.unmask(true); // unmask the dialog.
if (!success || ("OK" != response.responseText)) {
Ext.MessageBox.alert("Error", success ?
response.responseText :
"Error saving data - try again");
return;
}
dialog.hide();
// code to update stuff that's affected by the saved form working..
// goes here...
}
});
[b]接触Extjs's XMLHttpRequest 调用[/b]
Extjs's XMLHttpRequest 可以取代传统德XMLHttp来调用远程服务
例如:
dialog.el.mask("Saving...");
var con = new Ext.data.Connection();
con.request({
url: baseURL + "/mypage.txt", // where to post to..
params: params, // << key value object with data to send
method: 'POST',
callback: function(opts, success, response) {
dialog.el.unmask(true); // unmask the dialog.
if (!success || ("OK" != response.responseText)) {
Ext.MessageBox.alert("Error", success ?
response.responseText :
"Error saving data - try again");
return;
}
dialog.hide();
// code to update stuff that's affected by the saved form working..
// goes here...
}
});
本文介绍如何使用Extjs框架中的XMLHttpRequest组件替代传统的XMLHttp实现远程服务调用。通过具体示例展示了如何设置请求参数、指定请求方式及处理回调函数。

被折叠的 条评论
为什么被折叠?



