Jquery ajax登录。控制器中的形式等于零
我有以下fom:Jquery ajax登录。控制器中的形式等于零,jquery,ajax,asp.net-mvc,Jquery,Ajax,Asp.net Mvc,我有以下fom: form id="login_form" class="fancy_form" action="@Url.Action("Logon", "Account")" method="POST"> <div class="bl_label"> Eneter by login:</div> <div style="margin: 0px 30px 0px 30px;"> <div class
form id="login_form" class="fancy_form" action="@Url.Action("Logon", "Account")" method="POST">
<div class="bl_label">
Eneter by login:</div>
<div style="margin: 0px 30px 0px 30px;">
<div class="wrap_input" style="display: inline-block;">
<p class="inp_label">
Login:</p>
<i> </i>
<input type="text" value="" style="width: 131px">
</div>
<div class="wrap_input" style="display: inline-block; margin-left: 15px;">
<p class="inp_label">
Password:</p>
<i> </i>
<input type="password" value="" style="width: 131px">
</div>
<div id="error">
</div>
</div>
<div style="margin: 17px 30px 0px 30px; line-height: 20px;">
<a href="javascript:void(0);" style="margin-right: 20px;">Forgot Password?</a> <a href="javascript:void(0);">
Register?</a>
<input type="submit" class="ibtn" value="Готово" style="float: right;">
</div>
</form>
用于测试的控制器:
public JsonResult LogOn()
{
var test = Request.Form;
return new JsonResult();
}
请求中的表单
属性不包含任何内容(计数
=0,所有键
为空)
问题出在哪里?您的输入元素缺少“name”属性
看
引述:
注意:只有具有name属性的表单元素在提交表单时才会传递其值
你应该考虑使用HTML帮助器来帮助你创建正确的HTML代码:
public JsonResult LogOn()
{
var test = Request.Form;
return new JsonResult();
}