Self-AJAX-updating partial-view/controller in ASP.Net MVC and the duplicating div

后端 未结 6 591
生来不讨喜
生来不讨喜 2021-01-04 12:04

I have a partial view in MVC that goes something like:

...

Inside that div there\'s a form tha

6条回答
  •  执笔经年
    2021-01-04 12:42

    The unobtrusive Ajax library that ships with .NET MVC 3 uses callbacks that are based on the four callbacks from jQuery.ajax. However, the InsertionMode = InsertionMode.Replace from the Ajax.BeginForm method does not result in jQuery's replaceWith being called. Instead, .html(data) is used to replace the contents of the target element (and not the element itself).

    I have described a solution to this problem on my blog: http://buildingwebapps.blogspot.com/2011/11/jquerys-replacewith-and-using-it-to.html

提交回复
热议问题