{
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else //IE5、IE6
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
if (typeof callback === "function")
{
callback(xmlhttp.responseText);
}
}
}
}
if(type.toUpperCase() == "POST")
{
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.send(params);
}
else
{
xmlhttp.open("GET",url,true);
xmlhttp.send(params);
}
}
function CUser()
{
this.id;
this.nicName;
this.password;
this.role;
this.trueName;
this.addr;
this.phone;
this.qq;
this.wechat;
this.email;
this.info;
this.sex;
this.birthday;
}
function AddUserInParams()
{
this.cmd="A";
this.userSct = new CUser();
}
var inParams = new AddUserInParams();
inParams.userSct.nicName = $('#tbx_nicName').val();
inParams.userSct.password = $('#tbx_pwd').val();
inParams.userSct.role = $('#com_role').val();
inParams.userSct.trueName = $('#tbx_trueName').val();
inParams.userSct.addr = $('#tbx_addr').val();
inParams.userSct.phone = $('#tbx_phone').val();
inParams.userSct.qq = $('#tbx_qq').val();
inParams.userSct.wechat = $('#tbx_wechat').val();
inParams.userSct.email = $('#tbx_email').val();
inParams.userSct.info = $('#tbx_info').val();
inParams.userSct.sex = $('input:radio[name="rad_sex"]:checked').val();
inParams.userSct.birthday = $('#tbx_birth').val();
strInparam = JSON.stringify(inParams);
nt_Ajax("post","http://localhost/service/User/addUser","usr="+strInparam,ShowResp);