У меня есть следующий код:
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>
Это мой скрипт:
$("#login_form").live("submit", function (event) {
event.preventDefault();
var form = $(this);
$.ajax({
// Get the action URL
url: form.attr('action'),
type: "POST",
// get all form variables
data: form.serialize(),
// upon success, the fragment of HTML from the Controller will be stored in loginResultHtml
success: function (loginResultHtml) {
// append the html to your login DIV id using jQuery.html function
$("#error").html(loginResultHtml);
}
});
});
Контроллер для теста:
public JsonResult LogOn()
{
var test = Request.Form;
return new JsonResult();
}
Свойство Form
в Request
ничего не содержится (Count
= 0, AllKeys
пусто)
Где проблема?