using Ajax for partial view loading in .NET MVC4 using Ajax for partial view loading in .NET MVC4 ajax ajax

using Ajax for partial view loading in .NET MVC4


  1. ditch # in UpdateTargetId = "#mainDiv"
  2. make sure you have jquery.unobtrusive-ajax.min.js script referenced on your page.


I copied your code into a brand new MVC4 project and it works fine.

See screenshot of the solution:

Brand new MVC4 project with Ajax.ActionLink

Hope this will give you a hint on what could be wrong.


I typically load partials like this using JQuery

$( document ).ready(function() {  $("#lnkPage1").click(function( event ) {    $('#mainDiv').load('Test/Pag1');  });  $("#lnkPage2").click(function( event ) {    $('#mainDiv').load('Test/Pag2');  });});