zoukankan      html  css  js  c++  java
  • jquery判断用户名称是否存在

    /// <reference path="../jquery-1.3.2-vsdoc.js" />
    $(document).ready(function(){
    checkConfirm();
    });
    //验证用户名是否存在
    function checkConfirm() {
        $("#TextBox_college_english_name").blur(function() {
            var gradename = $(this).val();
            var changeUrl = "../../handlers/cms/GetCollegeName.ashx?college_english_name=" + gradename;
            $.get(changeUrl, function(str) {

                if (str == '1') {
                    alert("已经存在英文名称为" + $("#TextBox_college_english_name").val() + "的院校,请查证!");
                    $("#TextBox_college_english_name").val("");
                } else {
                    $("#gradeInfo").html("");
                }
            })
            return false;
        })
    }

    ashx页面代码

    using System;
    using System.Collections;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    using System.Xml.Linq;

    using Study.BLL.College_BLL;
    namespace Study.Web.handlers.cms
    {
        /// <summary>
        /// $codebehindclassname$ 的摘要说明
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        public class GetCollegeName : IHttpHandler
        {

            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/plain";
               
                string username = context.Request.QueryString["college_english_name"].ToString();
                BLL_College bll_college = new BLL_College();
                DataTable dt = bll_college.GetCollegeEnglishName(username);
                if (dt.Rows.Count > 0)
                {
                    context.Response.Write("1");
                }
                else
                {
                    context.Response.Write("0");
                }
               
            }

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

  • 相关阅读:
    夏天里的敏捷:10月底总结会议笔记【问题笔记】
    如何给项目里面每个功能点设权限?
    操作svn汉化
    夏天里的敏捷[1]:搬家记
    如何去读一个有50万行代码的项目?
    如何去定位你在调用哪个function()?
    小鸡和代码代码重构[2]:MOVE METHOD
    SVN版本管理随笔
    .NET服务器端控件绑定数据源的问题
    看视频笔记1【wpf】
  • 原文地址:https://www.cnblogs.com/tongdengquan/p/6090603.html
Copyright © 2011-2022 走看看