封装过的Ajax工具类库
工具类:AjaxUtil.js
function findUser() {var userid = $("userid").value;if (userid) {AjaxUtil.request({url:"servlet/UserJsonServlet",params:{id:userid},type:'json',callback:process});}}function process(json){if(json){$("id").innerHTML = json.id;$("username").innerHTML = json.username;$("age").innerHTML = json.age;}else{$("msg").innerHTML = "用户不存在";$("id").innerHTML = "";$("username").innerHTML = "";$("age").innerHTML = "";}}function $(id) {return document.getElementById(id);}