I have an Ajax form with one input and a button. When submitting, the form should publish only the entered value in the action method. My form is placed correctly in the log method of the user controller, but when this is done, the page is redirected to / User / Log.
How can i avoid this?
<% using (Ajax.BeginForm("Log", "User", null, new AjaxOptions {HttpMethod = "POST" })) {%> Please enter the username: <%= Html.TextBox("Username", "")%> <input type="submit" /> <% } %>
Here is the mode of action:
public class UserController : Controller { [AcceptVerbs(HttpVerbs.Post)] public void ForgotPassword(FormCollection collection) { string username = collection["Username"];
Thanks, -Keith
Keith source share