更新时间:2023-11-03 18:59:10
.post方法到其他Controller操作并将此Json数据发送给它。然后我成功地在我的控制器操作中获取此json数据,并在转换后获取相同的数据。但是,当我将此数据作为模型提供给视图时,它不会将我重定向到此控制器操作。
以下是登录视图的代码:
.post method to other Controller action and send this Json data to it. Then I successfully get this json data in my controller action and also get back the same data after casting. But when I give this data to the view as a model it doesn't redirecting me to this controller action.
Here is the code for the login view:
@model OAS.Models.LoginModel
@{
ViewBag.Title = "Log in";
}
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
</hgroup>
<script type="text/javascript" src="~/Scripts/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-1.7.1.js"></script>
<script type="text/javascript">
(document).ready(function(){
var GetAuthenticateUserURl =http:// localhost :15000 / AuthenticateUser;
(document).ready(function () { var GetAuthenticateUserURl = "http://localhost:15000/AuthenticateUser";
(#Login)。click(function(){
var username = document.getElementById('username')。value;
if(username ==){
alert(输入用户名);
return;
}
var password = document.getElementById('password')。值;
if(密码==){
alert(输入密码);
return;
}
("#Login").click(function () { var username = document.getElementById('username').value; if (username == "") { alert("Enter username"); return; } var password = document.getElementById('password').value; if (password == "") { alert("Enter password"); return; }