JavaScript用JQueryコールサーバ側メソッド
2086 ワード
Server
[System.Web.Services.WebMethod]
public static string VeryUserName(string name)
{
string rtn = " , , 。";
if (name == "")
rtn = " 。";
if (name == "Insus.NET")
rtn = " , 。";
return rtn;
}
HTML :<asp:TextBox ID="TextBoxAccount" runat="server"></asp:TextBox><br />
<input id="btnrReg" type="button" value=" " onclick="VeryRegAccount()" />
Javascript :
[javascript]
view plain
copy
View Code
function VeryRegAccount() {
type: "POST",
data: '{name: "' + $("#<%= TextBoxAccount.ClientID%>")[0].value + '" }',
dataType: "json",
failure: function (response) {
}
}
alert(response.d);