asp怎么既能提交表单 又不刷新页面
asp怎么既能提交表单又不刷新页面asp怎么既能提交表单又不刷新页面asp怎么既能提交表单又不刷新页面...
asp怎么既能提交表单 又不刷新页面
asp怎么既能提交表单 又不刷新页面
asp怎么既能提交表单 又不刷新页面 展开
asp怎么既能提交表单 又不刷新页面
asp怎么既能提交表单 又不刷新页面 展开
展开全部
当然是ajax
function send_request(url,sendcontents,processfunction,iswait) {//初始化、指定处理函数、发送请求的函数
http_request = false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest) { //Mozilla 浏览器
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {//设置MiME类别
http_request.overrideMimeType('text/xml');
}
}
else if (window.ActiveXObject) { // IE浏览器
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http_request.setRequestHeader("content","text/html");
http_request.setRequestHeader("charset","utf-8");
} catch (e) {}
}
}
if (!http_request) { // 异常,创建对象实例失败
window.alert("不能创建XMLHttpRequest对象实例.");
return false;
}
http_request.onreadystatechange = processfunction;
// 确定发送请求的方式和URL以及是否异步执行下段代码
http_request.open("POST", url, iswait);
// http_request.setRequestHeader("Content-length",sendcontents.length);
http_request.send(sendcontents);
return true;
}
function send_request(url,sendcontents,processfunction,iswait) {//初始化、指定处理函数、发送请求的函数
http_request = false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest) { //Mozilla 浏览器
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {//设置MiME类别
http_request.overrideMimeType('text/xml');
}
}
else if (window.ActiveXObject) { // IE浏览器
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http_request.setRequestHeader("content","text/html");
http_request.setRequestHeader("charset","utf-8");
} catch (e) {}
}
}
if (!http_request) { // 异常,创建对象实例失败
window.alert("不能创建XMLHttpRequest对象实例.");
return false;
}
http_request.onreadystatechange = processfunction;
// 确定发送请求的方式和URL以及是否异步执行下段代码
http_request.open("POST", url, iswait);
// http_request.setRequestHeader("Content-length",sendcontents.length);
http_request.send(sendcontents);
return true;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询