濮阳杆衣贸易有限公司

主頁 > 知識庫 > Ajax郵箱、用戶名唯一性驗證實例代碼

Ajax郵箱、用戶名唯一性驗證實例代碼

熱門標簽:外呼系統(tǒng)api對接 提高電話機器人接通率 大學(xué)校門地圖標注 荊州智能電銷機器人 福建微碼電話機器人 銷售電銷機器人詐騙 平?jīng)龈叩碌貓D標注商戶要收費嗎 廣西智能外呼系統(tǒng)多少錢 地圖標注與公司業(yè)務(wù)關(guān)系

廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:

 script type="text/javascript">
    $(function () { 
      $("#txtEmail").blur(function () {
        $.ajax({
          type: "post",
          url: "reg.ashx?email=" + $.trim($("#txtEmail").val()) + "d=" + (+new Date()),
          success: function (data) {
            var vCount = parseInt(data);
            if (vCount == 0) {
              alert("郵箱可以使用");
            }
            else {
              alert("郵箱已經(jīng)被占用");
            }
          }
        });
      });
      $("#checkpwd").blur(function () {
        return CheckPwd();
      });
    });
    function CheckPwd()
    {
      var bCheck = true;
      if ($.trim($("#pwd").val()) != $.trim($("#checkpwd").val()))
      {
        alert("兩次密碼輸入不一致");
        bCheck = false;
      }
      return bCheck;
    }
  /script>

reg.ashx代碼:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebT1.Ti.html2
{
  /// summary>
  /// reg 的摘要說明
  /// /summary>
  public class reg : IHttpHandler
  {
    public void ProcessRequest(HttpContext context)
    {
      if (context.Request["email"] != null)
      {
        string strEmail = context.Request["email"];
        ListUserModel> lstUser = DataService.GetUserList();
        var v = lstUser.Where(p => p.Email == strEmail);
        int iCount = 0;
        if (v.Count() > 0)
        {
          iCount = 1;
        }
        context.Response.ContentType = "text/plain";
        context.Response.Write(iCount.ToString());
      }
    }
    public bool IsReusable
    {
      get
      {
        return false;
      }
    }
  }
  public class DataService
  {
    /// summary>
    /// 模擬已注冊用戶數(shù)據(jù)
    /// /summary>
    public static ListUserModel> GetUserList()
    {
      var list = new ListUserModel>();
      list.Add(new UserModel() { Email = "t1@demo.com" });
      list.Add(new UserModel() { Email = "t2@demo.com" });
      list.Add(new UserModel() { Email = "t3@demo.com" });
      list.Add(new UserModel() { Email = "t4@demo.com" });
      list.Add(new UserModel() { Email = "t5@demo.com" });
      return list;
    }
  }
  public class UserModel
  {
    public string Email { get; set; }
  }
}

總結(jié)

以上所述是小編給大家介紹的Ajax郵箱、用戶名唯一性驗證實例代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

您可能感興趣的文章:
  • PHP+Ajax異步通訊實現(xiàn)用戶名郵箱驗證是否已注冊( 2種方法實現(xiàn))
  • Ajax實時驗證用戶名/郵箱等是否已經(jīng)存在的代碼打包

標簽:黔東 衡陽 內(nèi)江 海南 婁底 德陽 樂山 邯鄲

巨人網(wǎng)絡(luò)通訊聲明:本文標題《Ajax郵箱、用戶名唯一性驗證實例代碼》,本文關(guān)鍵詞  Ajax,郵箱,用,戶名,唯一性,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Ajax郵箱、用戶名唯一性驗證實例代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于Ajax郵箱、用戶名唯一性驗證實例代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    阜阳市| 宁海县| 泗洪县| 怀集县| 石渠县| 广南县| 罗甸县| 百色市| 疏附县| 安顺市| 淮北市| 大姚县| 偃师市| 台湾省| 胶州市| 成都市| 读书| 石门县| 巴林左旗| 浦江县| 剑川县| 马边| 北川| 彩票| 两当县| 通榆县| 湾仔区| 平陆县| 禄丰县| 博湖县| 建阳市| 卓资县| 江口县| 蒙山县| 晋城| 筠连县| 荣成市| 娄底市| 汕头市| 江孜县| 黔东|