I have the following Ajax in order to submit form data for logging in.
<form action="/Account/Login" data-ajax="true" data-ajax-mode="replace" data-ajax-update="#loginSection" method="post"> <input type="submit" value="Log in" />
It works fine on the first post. However, when the user click the button a second time, 3 ajax posts occur. Then 8 times and so on. At first I thought it was because the Submit button was getting replaced, so I took it out of the "loginSection" But the same behavior is occurring.
So why is this occurring and what do I need to change? It makes no sense to me.
Here is the full LoginPartial with the ajax:
@model NTC.PropertySearch.Models.LoginModel
@{
ViewBag.Title = "Log in";
}
@using (Ajax.BeginForm("Login", "Account", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "loginSection", }))
{
@Html.Partial("_LoginInfoPartial", Model)
<input type="submit" value="Log in" />
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"> </script>
@charlietfl, you are right. It did, and when I removed it, everything works ok now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.