<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ WebHandler Language="C#" Class="Show" %>using System;using System.Web;using System.Data;using System.Linq;using System.Data.Linq;public class Show : IHttpHandler { public void ProcessRequest (HttpContext context) { //取值 string code = context.Request["code"].ToString(); //操作数据库 TextDataContext Context = new TextDataContext(); Info data = Context.Info.Where(p => p.Code == code).First(); context.Response.Write(" "); context.Response.Write(""); context.Response.Write(" "); context.Response.End(); } public bool IsReusable { get { return false; } }}" + data.Name + " "); context.Response.Write("" + data.Sex.ToString() + " "); context.Response.Write("" + data.Nation + " "); context.Response.Write("" + data.Birthday.Value.ToString("yyyy年MM月dd日") + " "); context.Response.Write(""); context.Response.Write(" hello
//调AJAX $.ajax({ url: "Show.ashx", type: "POST", data: { code: code }, datatype: "XML", success: function (data) { $("#name").text($(data).find("Name").eq(0).text()); $("#sex").text($(data).find("Sex").text()); $("#nation").text($(data).find("Nation").text()); $("#birthday").text($(data).find("Birthday").text()); } }) }) })