js ajax实现
来源:互联网 发布:java bigdecimal最大值 编辑:程序博客网 时间:2024/06/05 17:42
{
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);
- 【Js】js实现ajax
- AJAX-prototype.js实现Ajax
- ajax js实现
- js实现ajax
- js实现ajax
- js实现ajax请求
- ajax+JS 实现分页
- Ajax-Js实现
- 原生js实现Ajax
- 原生js实现ajax
- 原生JS实现Ajax
- js实现ajax
- 原生js实现ajax
- AJAX实现(JS)
- 用js实现Ajax
- Js实现Ajax
- js实现ajax
- js实现ajax
- shell学习二十三--case语句编写mysql启动脚本
- 获取鼠标位置坐标
- python那点事儿
- Distinctive Character
- ccf 201703 4
- js ajax实现
- 第十二周 项目(3)
- 唯快不破:当你在地址栏输入一个URL地址回车后,将会发生什么事情
- Planning mobile robot on Tree (EASY Version) UVA
- 特殊的二街魔方
- 以太坊挖矿软件反抽水-eth 免抽成破解收费小插件 (完美兼容 Claymore 原版内核,长沙矿工,圣骑士,挖矿专家,矿工队长)
- headfirst插入排序
- Could not find method on interface org.apache.ibatis.executor.statement.StatementHandler
- 后缀数组学习总结