Jquery Ajax 调用 ashx 返回结果

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Ctrip.Flight.Process.Site
{
    /// 
    /// Summary description for json
    /// 
    public class json : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.Params.Count != 0)
            {
                context.Response.ContentType = "text/plain";

                if (context.Request.Params["TxtOrderId"] != null && context.Request.Params["TxtSendTicketCityName"] != null)
                {
                    int OrderId = int.Parse(context.Request.Params["TxtOrderId"].ToString());
                    string SendTicketCityName = context.Request.Params["TxtSendTicketCityName"].ToString();

                    string content = String.Format("{{\"TxtOrderId\":\"{0}\",\"TxtSendTicketCityName\":\"{1}\"}}", OrderId, SendTicketCityName);
                    context.Response.Write(content);
                }
            }
            else
            {
                context.Response.Write("no values");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}


 

    


 

你可能感兴趣的:(JQuery)