JQuery调webservice实现邮箱验证(检测是否可用)
代码如下:
<asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="~/WebService1.asmx" /> </Services> </asp:ScriptManager> SinaWeiBo.WebService1.cunzai($(this).val(), a, b) { function a(result) { if (result == "该邮箱已存在请重新输入") { $('#txtusername').val(''); $('#txtusername').focus(); $('#emailyz').text(result); } else { $('#emailyz').text('可以使用'); } } function b() { $('#emailyz').text('没有返回值'); } }
webservice:
代码如下:
public string cunzai(string txtusername) { //判断邮箱存不存在 try { SinaWeiBo.BLL.T_Users bt1 = new BLL.T_Users(); DataSet ds = new DataSet(); ds = bt1.GetList(" T_UserEmail='" + txtusername + "'"); string cha = ds.Tables[0].Rows[0][0].ToString(); return "该邮箱已存在请重新输入"; } catch { return "正确"; } }
相关推荐
mmyCSDN 2020-02-10
stulen 2020-01-21
hedongli 2019-12-31
luofuIT成长记录 2019-12-07
huzai 2015-04-22
sdnxiaotao 2019-04-02
精通正则表达式 2013-09-23
89203856 2013-04-27
peterwzc 2011-11-23
Gyc 2011-09-08
Lucianoesu 2014-09-01
CommputerMac 2017-01-20
87941037 2017-12-05
zlxcsdn 2017-12-11
差沙 2016-05-09
前端档案 2015-11-16
YUYISHARE 2019-04-23