Jquery中$.ajax()方法参数详解

2019-09-14 07:03:15王冬梅

一般处理程序

<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.Data.SqlClient;
using System.Web.SessionState;//继承接口IReadOnlySessionState需要引入的命名空间
public class Handler : IHttpHandler, IRequiresSessionState
{
  SqlHelper helper = new SqlHelper();
  public void ProcessRequest(HttpContext context)
  {
    context.Response.ContentType = "text/plain";
    string username = context.Request.Params["username"].ToString().Trim();
    string pwd = context.Request.Params["pwd"].ToString().Trim();
    if (username != "" && pwd != "")
    {
      string sql = @"SELECT * FROM [USER] WHERE USERNAME='"+username+"' AND PASSWORD='"+pwd+"' ";
      if (!helper.Exists(sql))
      {
        context.Response.Write("0");
      }
      else
      {
        SqlDataReader reader = helper.ExecuteReader(sql);
        while (reader.Read())
        {
          context.Response.Write("1");
          context.Session["username"] = username.ToString().Trim();
          context.Session["pwd"] = pwd.ToString().Trim();
        }
      }
    }
  }
  public bool IsReusable
  {
    get
    {
      return false;
    }
  }
}

以上内容是小编给大家分享的Jquery中$.ajax()方法参数详解,希望大家喜欢。