52,799
社区成员
发帖
与我相关
我的任务
分享
Stream stream = Page.Request.InputStream;
StreamReader sr = new StreamReader(stream, System.Text.Encoding.Default);
string str = sr.ReadToEnd();
str 就是前台传进来的数据
ajax实现核对用户名
-------------------------------------
一、var objXML;
function UpateOnline(){
try{
objXML = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("您的浏览器不支持本考试");
return false;
}
var user_name = document.getElementById("user_name").value;
objXML.open("Get","../maintain/customer_getName.action?user_name="+user_name,true);
objXML.onreadystatechange = callback;
objXML.send();
}
function callback(){
if (objXML.readyState == 4){
if (objXML.status == 200){
var resText = objXML.responseText;
if(resText == "yes"){
alert("用户名已存在,请重新输入");
document.listform.user_name.value = "";
document.listform.password.value = "";
document.listform.repassword.value = "";
document.listform.user_name.focus();
}
return;
}
}
}
function responseMethod(resText,fname){
if(resText == "yes"){
alert("用户名已存在,请重新输入")
document.listform.user_name.value = "";
document.listform.password.value = "";
document.listform.repassword.value = "";
document.listform.user_name.focus();
}
return;
}
function getName(name){
send_request("post","../maintain/customer_getName.action","user_name="+document.getElementById("user_name").value,name);
}
二、
var objXML;
function UpateOnline(){
try{
objXML = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("您的浏览器不支持本考试");
return false;
}
var ideCode = document.forms[0].ideCode.value;
objXML.open("Get","../UpateOnlineState?ideCode="+ideCode,true);
objXML.onreadystatechange = callback;
objXML.send();
}
function callback(){
if (objXML.readyState == 4){
if (objXML.status == 200){
var str = objXML.responseText;
if (str == "02"){
closeForm();
}
}
}
}