jquery判断用户名称是否存在
2010-06-13 13:31
633 查看
/// <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;
}
}
}
}
$(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;
}
}
}
}
相关文章推荐
- jQuery 判断用户是否存在
- 判断数据库中对象(表、视图等)名称是否存在的SQL语句
- Visual Basic 中判断指定名称的进程是否存在
- jQuery判断获得的对象是否存在的方法
- jQuery判断iframe中元素是否存在的方法
- [C/C++]_[初级]_[通过映像名称判断进程是否存在]
- Jquery判断Id是否存在
- jQuery判断获得的对象是否存在的方法
- jQuery判断是否存在滚动条的简单方法
- 如何使用JQuery去判断一个元素(对象)是否存在
- 判断用户是否存在
- 判断用户是否存在
- 用jquery判断一个对象是否存在不能用
- Jquery]判断某个标签 Id是否存在
- C#.NET对注册表的常用操作(增加项,判断指定项是否存在,增加键(键的名称,键的数值),判断指定的键是否存在)
- Java判断id,用户,是否存在问题
- jquery 判断数组里是否存在重复
- 关于jQuery判断元素是否存在的问题示例探讨
- jQuery中判断元素是否存在的方法
- jquery判断一个文件是否存在函数写法的历程