解决方案 »

  1.   

    http://www.cnblogs.com/myaspnet/archive/2010/11/12/1876101.html
      

  2.   

    using System;using System.Web;public class Handler :IHttpHandler {     publicvoid ProcessRequest (HttpContext context) {        charmethod = Convert.ToChar(context.Request.Params["m"]);        context.Response.ContentType= "text/plain";        switch(method)        {            case'a':                context.Response.Write("HelloWorld<br/>This is a sample");                return;            case'b':                context.Response.Write("HelloWorld<br/>This is b sample");                return;                        }        context.Response.Flush();      }}$(document).ready(function(){            $("#test2").click(function(){                $.ajax({                    type: "post",                    url: "Handler.ashx",                    data: {m:'a'},                    success: function(result){                        $("#testText").append(result+ "<br/>");                    }                });            });        });        $(document).ready(function(){            $("#test3").click(function(){                $.ajax({                    type: "post",                    url: "Handler.ashx",                    data: {m:'b'},                    success: function(result){                        $("#testText").append(result+ "<br/>");                    }                });            });        });                    url: "Handler.ashx",                    data: {m:'b'},                    success: function(result){                        $("#testText").append(result+ "<br/>");                    }                });            });        });
      

  3.   

    前端将数据转成json格式,用jquery的ajax方法,post到后端。后端接受json后反序列化得到对象。