There are two methods in the Home controller:

public class HomeController : Controller { public ActionResult Index() { return View(); } //[HttpPost] public ActionResult Load() { return PartialView(); } } 

I am trying to load a partial view asynchronously from the Load method. I do this:

 <button class="btn btn-default loadbook" type="submit"> @Ajax.ActionLink("ClickMe","Load", new AjaxOptions(){UpdateTargetId="di"}) </button> 

but it refreshes the page and loads it on a new page.
What could be the problem?

    2 answers 2

    You have a submit button type, so its pressing causes the page to be updated, change it to button

    • It does not solve the problem. It still goes to the view that the Load method returns. But I want the view that the Load method returns to become immersed in the current view on which this button is located. Therefore, it is made a partial view. - Sasuke

    It did not work until you installed the package from NuGet for Ajax - Microsoft.JQuery.Unobtrusive.Ajax