ユーザーがユーザー名とパスワードを入力できるログインページがありますテキストボックスのコンテンツを含むdivを非表示にします私の方法が非常に悪いことは知っていますが、より良い解決策はありません。 3 回ですか?クライアント側のない c# コードと jquery を使用してこの作業を行いたいです。
$.ajax(
{
type: "POST",
url: "loginpg.aspx/loginmtd",
data: JSON.stringify({
username: username,
password: password
}),
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (ret) {
if (ret.d != "" && hasError == false) {
$(".error").hide();
hasError = true;
$('#result').after('<span class="error"> welcome ' + ret.d + '</span>');
} else if (hasError == false) {
$(".error").hide();
hasError = true;
if (failcount < 3) {
$('#result').after('<span class="error">password is wrong' + ret.d + '</span>');
ret = "";
failcount += 1;
} else {
$(".hid").hide(1000);
}
}
},
error: function (x, e) {
hasError = true;
$('#result').after(x.responseText);
}
});