天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

Jquery+WebService 校驗(yàn)賬號(hào)是否已被注冊(cè)的代碼

詳細(xì)代碼如下:
Default.ASPx
復(fù)制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.ASPx.cs" Inherits="Ajax_XML._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script type="text/Javascript" src="jquery-1.3.2-vsdoc2.js" language="Javascript"></script>
<script type="text/Javascript" language="Javascript">
$(function() {
$("#<%=UserID.ClientID%>").keyup(
function() {
$.ajax({
type: "POST",
contentType: "application/json",
dataType: "json",
url: "WebService1.asmx/UserIsExist",
data: "{UserID:'" + $("#<%=UserID.ClientID%>").val() + "'}",
success: function(result) {
if (result.d == "true")
$("#<%=IsExist.ClientID%>").text("Yes");  //賬號(hào)已存在
else
$("#<%=IsExist.ClientID%>").text("No");  
}
});
}
);
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width:100%;">
<tr>
<td>
 </td>
<td>
 </td>
<td>
 </td>
</tr>
<tr>
<td>
 </td>
<td>
<ASP:TextBox ID="UserID" runat="server"></ASP:TextBox>
<ASP:Label ID="IsExist" runat="server" Visible="true"></ASP:Label>
</td>
<td>
 </td>
</tr>
<tr>
<td>
 </td>
<td>
 </td>
<td>
 </td>
</tr>
</table>
</div>
</form>
</body>
</html>

WebService1.asmx.cs
復(fù)制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using DAL;
namespace Ajax_XML
{
/// <summary>
/// WebService1 的摘要說(shuō)明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允許使用 ASP.NET AJAX 從腳本中調(diào)用此 Web 服務(wù),請(qǐng)取消對(duì)下行的注釋。
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello,World!";
}
[WebMethod]
public string UserIsExist(string UserID)
{
string sql = string.Format("select * from Customers where FirstName='" + UserID+"'");
using (SqlDataReader dr = SqlHelper.ExecuteSql(sql))
{
if (dr.Read())
return "false";
else
return "true";
}
}
}
}

SqlHelper.cs
復(fù)制代碼 代碼如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace DAL
{
/// <summary>
/// 數(shù)據(jù)庫(kù)操作類
/// </summary>
public class SqlHelper
{
private static SqlConnection conn;
private static SqlCommand comm;
private static SqlDataReader dr;
/// <summary>
/// 打開(kāi)數(shù)據(jù)庫(kù)連接
/// </summary>
public static void ConnOpen()
{
try
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BBS"].ConnectionString);
conn.Open();
}
catch (Exception e)
{
Console.WriteLine( e.Message);
}
}
/// <summary>
/// 關(guān)閉數(shù)據(jù)庫(kù)連接,釋放資源
/// </summary>
public static void ConnClose()
{
if (conn != null)
{
conn.Close();
}
if (comm != null)
{
comm.Dispose();
}
}
public static SqlDataReader ExecuteSql(string sql)
{
SqlHelper.ConnOpen();
comm = new SqlCommand(sql, conn);
try
{
dr = comm.ExecuteReader();
return dr;
}
catch (Exception e)
{
throw e;
}
}
}
}

JavaScript技術(shù)Jquery+WebService 校驗(yàn)賬號(hào)是否已被注冊(cè)的代碼,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 久久www免费人成_看片高清 | 十七岁日本免费完整版BD | 男女一边摸一边做羞羞的事情免费 | 亚洲国产在线2020最新 | 黄色天堂在线 | 国产成人永久免费视频 | 亚洲视频一区在线 | 亚欧日韩毛片在线看免费网站 | 把内衣脱了把奶露出来 | 99热在线免费观看 | 秋霞电影网午夜一级鲁丝片 | 伊人网综合在线观看 | 野花视频在线观看免费 | 把英语老师强奷到舒服动态图 | XXX国产麻豆HD | 男人插曲视频大全免费网站 | 国产精品久久久亚洲偷窥女厕 | 亚洲精品免费视频 | 医生含着我的奶边摸边做 | 国内精品乱码卡一卡2卡三卡新区 | 啦啦啦影院视频在线看高清... | 亚洲国产高清福利视频 | 国产亚洲精品久久久久久国模美 | www伊人网 | 中文字幕在线观看亚洲日韩 | 欧美91精品久久久久网免费 | 苍井空教师BD在线观看全集 | 99久久久A片无码国产精 | 浴室里强摁做开腿呻吟的漫画 | 帅小伙和警官同性3p | 中文无码乱人伦中文视频播放 | 最近2019年日本中文免费字幕 | 忘忧草在线社区WWW日本-韩国 | 18禁止观看免费私人影院 | 少妇厨房愉情理9伦片视频 少妇被躁爽到高潮无码久久 | 免费毛片播放 | 亚洲国产精品第一影院在线观看 | 美女内射少妇三区五区 | 我们中文在线观看免费完整版 | 国产免费怕怕免费视频观看 | 早乙女由依在线观看 |