日期:2014-05-16 浏览次数:20720 次
$.ajax({
url: "getfriendinfo",
type: "post",
data: {fid:fid},
contentType: "application/x-www-form-urlencoded;charset=utf-8",
success: function(data){
$(data).find("friend").each(function(){
var nickname=$(this).find("nickname").text(); //nickname
var sex=$(this).find("sex").text();//sex
var age=$(this).find("age").text();//age
if(sex="man")
sex="男";
else
sex="女";
$("#nickname"+fid).text("昵称:"+nickname);
$("#age"+fid).text("年龄:"+age);
$("#sex"+fid).text("性别:"+sex);
});
resp.setContentType("text/xml;charset=UTF-8'");
buf.append("<?xml version='1.0' encoding='UTF-8'?>");
if (rs != null && rs.next()) {
buf.append("<friend>");
buf.append("<nickname>"+rs.getString("nickname")+"</nickname>");
buf.append("<age>"+rs.getString("age")+"</age>");
buf.append("<sex>"+rs.getString("sex")+"</sex>");
buf.append("</friend>");
}
pw.write(buf.toString());
pw.flush();