我在 JavaScript 中嵌套 razor C#,我在一个按钮内调用这个函数,但是当我按下按钮时没有任何反应。我究竟做错了什么?
<script>
@functions{
public void Validation()
{
StudentTable sTable = new StudentTable();
var username = Request["username"];
var password = Request["password"];
var error = "";
if(sTable.Login(username, password) != null)
{
Response.Redirect("Success.html");
}
else
{
error = "Username/password entered is incorrect";
}
</script>
}
}
<p>@error</p>
<button class="btn btn-default btn-primary" id="signin" type="submit" value="Signin" onclick="@functions" formmethod="post">Sign in</button>