我正在对C#函数进行ajax调用,但它没有被调用。 ' frmListOfUsersOfflinePartial'是我的表格名称。如果我在ajax调用后删除return false语句,它将转到主页,而不是命中该函数
查看:
@using (@Html.BeginForm("ListOfUsersOffline", "Admin", new { operation = operation, userid = userid ,roleId = roleId}, FormMethod.Post, new { id = "frmListOfUsersOfflinePartial" }))
{
@Html.ActionLink("Search", "", "", null, new { id = "lnkChooseRegOfficeName", @class = "btn btn-primary" })
}
<script type="text/javascript">
$("#lnkChooseRegOfficeName").click(function (e)
{
var url = '@Url.Content("~/")' + "Admin/RegistrationOfficeNameForUsers";
$.ajax({
url: url,
type: 'Get',
data: $('#frmListOfUsersOfflinePartial').serialize(),
success: function (data) {
alert(url);
}
});
return false;
});
</script>
控制器:
[HttpGet]
public ActionResult RegistrationOfficeNameForUsers(ListOfUsers listOfUsers, string operation, int userid)
{
//Not getting hit
}