熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

JQuery調webservice實現郵箱驗證

2022-06-13   來源: JSP教程 

  代碼如下:


<asp:ScriptManager ID="ScriptManager" runat="server">
<Services>
<asp:ServiceReference Path="~/WebServiceasmx" />
</Services>
</asp:ScriptManager>
SinaWeiBoWebServicecunzai($(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
{
SinaWeiBoBLLT_Users bt = new BLLT_Users();
DataSet ds = new DataSet();
ds = btGetList(" T_UserEmail=" + txtusername + "");
string cha = dsTables[]Rows[][]ToString();
return "該郵箱已存在請重新輸入";
}
catch {
return "正確";
}

From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20589.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.