代码
function(url) {
function createXhrObject() {
var http;
var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
try {
http = new XMLHttpRequest();
} catch (e) {
for (var i = 0; i < activeX.length; ++i) {
try {
http = new ActiveXObject(activeX[i]);
break;
} catch (e) { }
}
} finally {
return http;
}
};
var conn = createXhrObject();
conn.open("GET", url, false);
conn.send(null);
if (conn.responseText != '') {
return Ext.decode(conn.responseText);
} else {
return null;
}
};
function(url) {
function createXhrObject() {
var http;
var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
try {
http = new XMLHttpRequest();
} catch (e) {
for (var i = 0; i < activeX.length; ++i) {
try {
http = new ActiveXObject(activeX[i]);
break;
} catch (e) { }
}
} finally {
return http;
}
};
var conn = createXhrObject();
conn.open("GET", url, false);
conn.send(null);
if (conn.responseText != '') {
return Ext.decode(conn.responseText);
} else {
return null;
}
};
Ext3.0中异步加载方式:
Js代码
Ext.Ajax.request({
url : '',
params : { },
method : 'POST',
success : function(response) {
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert('信息', result.msg);
},
failure : function(response, options) {
}
})
Ext.Ajax.request({
url : '',
params : { },
method : 'POST',
success : function(response) {
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert('信息', result.msg);
},
failure : function(response, options) {
}
})
Ext3.0中表单Ajax提交
Js代码
form.form.submit({
waitMsg : '正在提交数据请稍后',// 提示信息
waitTitle : '提示',// 标题
url : '',// 请求的url地址
method : 'POST',// 请求方式
success : function(form, action) {// 加载成功的处理函数
Ext.Msg.alert('提示', action.result.msg);
},
failure : function(form, action) {// 加载失败的处理函数
Ext.Msg.alert('提示', '');
}
});
function createXhrObject() {
var http;
var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
try {
http = new XMLHttpRequest();
} catch (e) {
for (var i = 0; i < activeX.length; ++i) {
try {
http = new ActiveXObject(activeX[i]);
break;
} catch (e) { }
}
} finally {
return http;
}
};
var conn = createXhrObject();
conn.open("GET", url, false);
conn.send(null);
if (conn.responseText != '') {
return Ext.decode(conn.responseText);
} else {
return null;
}
};
function(url) {
function createXhrObject() {
var http;
var activeX = ['MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
try {
http = new XMLHttpRequest();
} catch (e) {
for (var i = 0; i < activeX.length; ++i) {
try {
http = new ActiveXObject(activeX[i]);
break;
} catch (e) { }
}
} finally {
return http;
}
};
var conn = createXhrObject();
conn.open("GET", url, false);
conn.send(null);
if (conn.responseText != '') {
return Ext.decode(conn.responseText);
} else {
return null;
}
};
Ext3.0中异步加载方式:
Js代码
Ext.Ajax.request({
url : '',
params : { },
method : 'POST',
success : function(response) {
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert('信息', result.msg);
},
failure : function(response, options) {
}
})
Ext.Ajax.request({
url : '',
params : { },
method : 'POST',
success : function(response) {
var result = Ext.util.JSON.decode(response.responseText);
Ext.Msg.alert('信息', result.msg);
},
failure : function(response, options) {
}
})
Ext3.0中表单Ajax提交
Js代码
form.form.submit({
waitMsg : '正在提交数据请稍后',// 提示信息
waitTitle : '提示',// 标题
url : '',// 请求的url地址
method : 'POST',// 请求方式
success : function(form, action) {// 加载成功的处理函数
Ext.Msg.alert('提示', action.result.msg);
},
failure : function(form, action) {// 加载失败的处理函数
Ext.Msg.alert('提示', '');
}
});