I am trying to clear an ajax form after an element has been added to the database, however OnComplete and OnSuccess AjaxOptions are called before submitting the form. How can I get it so that the form is submitted first and is called OnComplete.
<% using (Ajax.BeginForm("AddTable", new AjaxOptions { UpdateTargetId = "tables", InsertionMode = InsertionMode.InsertAfter, OnComplete = "ClearForm()" })) {%>
which causes
function ClearForm() { $('#DisplayName').val(''); }
However, the DisplayName text field is cleared before the ballet is passed to the controller to which the form is submitted. Is there any way around this.
asp.net-mvc
Israfel
source share