Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC4 Ajax.BeginForm not replacing UpdateTargetId
    text
    copied!<p>There are so many topics on SO about issues with the Ajax.BeginForm not correctly updating the target element with the return partial view:<br> <a href="https://stackoverflow.com/questions/12483812/mvc4-ajax-updating-same-page">mvc4 ajax updating same page</a><br> <a href="https://stackoverflow.com/questions/12512417/asp-net-mvc-4-ajax-beginform-and-html5">ASP.NET MVC 4 - Ajax.BeginForm and html5</a><br> <a href="https://stackoverflow.com/questions/13374035/mvc-4-razor-controller-is-returning-a-partialview-but-entire-page-is-being-u">MVC 4 (razor) - Controller is returning a partialview but entire page is being updated</a><br> <a href="https://stackoverflow.com/questions/13626225/mvc-4-ajax-is-not-updating-the-partialview-within-the-page">MVC 4 Ajax is not updating the PartialView within the page</a><br> However, all of these are answered by either manually writing out the jQuery ajax, or including a missing javascript file.</p> <pre><code> @using (Ajax.BeginForm("PostcardDetails", new AjaxOptions() { InsertionMode = InsertionMode.Replace, UpdateTargetId = "details" })) { &lt;div id="PostcardSearchResults"&gt; @{Html.RenderAction("PostcardSearchResults", Model);} &lt;/div&gt; } &lt;div id="details"&gt; &lt;/div&gt; </code></pre> <p>Relevant controller code:</p> <pre><code>[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get)] public ActionResult PostcardSearchResults(PostcardSearchFilter filter) { PostcardSearchResults model = new PostcardSearchResults(filter); return PartialView("_PostcardSearchResults", model); } </code></pre> <p>In my layout, I am referencing these jQuery files. Additionally, I've verified that the page is outputting the proper path, and that it finds the correct files. I've tried switching the ordering of <code>unobtrusive-ajax.min.js</code> and <code>validate.min.js</code>, to no success.</p> <pre><code>&lt;script type="text/javascript" src="@Url.Content("~/Scripts/globalize.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.9.1.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-1.10.0.custom.min.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"&gt;&lt;/script&gt; </code></pre> <p>Additionally, in my website's root web.config, and the web.config in my View folder, I have included:</p> <pre><code>&lt;add key="webpages:Version" value="2.0.0.0"/&gt; &lt;add key="PreserveLoginUrl" value="true"/&gt; &lt;add key="ClientValidationEnabled" value="true"/&gt; &lt;add key="UnobtrusiveJavaScriptEnabled" value="true"/&gt; </code></pre> <p>I'm at a loss for where else to look. There are no javascript errors being thrown, and the controller is being properly hit, returning a PartialViewResult. The Form element in the HTML is populating all the correct <code>data-</code> attributes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload