时间:2021-07-01 10:21:17 帮助过:33人阅读
这里实现使用jQuery和一般处理程序即时验证用户录入的学号是否重复,当光标离开输入框即给出提示。
一般处理程序Check.ashx代码:
- <%@ WebHandler Language="C#" class="Check" %>
- using System;
- using System.Web;
- public class Check : IHttpHandler {
- public void ProcessRequest (HttpContext context) {
- context.Response.ContentType = "text/plain";
- string num = context.Request["txtNum"].ToString();
- bool result = false;
- if(num=="12")//为了简化代码,没有访问数据库。实际项目应查询数据库。
- {
- result = true;
- }
- context.Response.Write(result);
- }
- public bool IsReusable {
- get {
- return false;
- }
- }
- }
希望本文所述对大家jQuery程序设计有所帮助。