Here is the scenario:
Ajax.BeginForm()
If I render the partial view with the original view with Html.Partial()
(instead of adding it using JavaScript) the form is only submitted once, as expected.
The script for adding the partial view looks like this:
$.ajax({
type: 'GET',
url: '/MyController/MyAction',
cache: false,
contentType: "application/html; charset=utf-8",
dataType: 'html',
success: function (result) {
$('#body').append(result);
}
});
Any ideas? :) Thanks!
I'm an idiot. My controller returned View instead of PartialView - so of course it contained all the JavaScript resources. In other words, problem was caused by double unobtrusive script links . :/
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.