Asp.NET MVC AjaxOptions OnSuccess fires.. too early?

后端 未结 5 1628
情话喂你
情话喂你 2020-12-09 12:27

I\'d like to use the OnSuccess option of AjaxOptions passed as Ajax.BeginForm argument to \"do something\" once the response is completely received and DOM updated. As far a

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 12:54

    Not sure how helpful this will be but I am looking at doing something like this at the moment and have found if you call out to a function within the OnSucess then it will happen after the action method, for example:

    using (Ajax.BeginForm("DoLongTask", "Home", 
        new AjaxOptions() {
            UpdateTargetId = "divPlaceholder", 
            InsertionMode = InsertionMode.Replace,
            OnSuccess = "function() { alert('onsuccess fired'); }"
        })) 
    

提交回复
热议问题