@using(Html.BeginForm("About", "User", FormMethod.Post , new { id="aboutme"}))
{
<fieldset>
<ul>
<li> <label class="block">About me</label> @Html.TextAreaFor(m=>m.About.AboutMe)</li>
<li> <input type="button" id="submit" class="input-button" /> </li>
</ul>
</fieldset>
}
<script type="text/javascript">
$(function () {
$('#submit').click(function () {
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result) {
// The AJAX call succeeded and the server returned a JSON
// with a property "s" => we can use this property
// and set the html of the target div
alert(result.s);
$('#ShowResultHere').html(result.s);
}
});
// it is important to return false in order to
// cancel the default submission of the form
// and perform the AJAX call
return false;
});
});
</script>
当我调试它时,操作 URL 变为/User/undefined
.
我该如何解决?