javascriptajaxasp.net-mvcmicrosoft-ajax

The whole page loads with ajax mvc


I'm new to MVC and ajax, and I just can't make an example from MSDN work : http://msdn.microsoft.com/fr-fr/library/dd381533(v=vs.100).aspx

This code reloads the entire page when I clic on the actionlink or the button. I have the scripts MicrosoftAjax-debug.js and MicrosoftMvcAjax-debug.js and I added it to the Site.Master.

Did I miss something ?

    <head runat="server">
    <meta charset="utf-8" />
    <title>
        <asp:ContentPlaceHolder ID="TitleContent" runat="server" />
    </title>
    <link href="<%: Url.Content("~/favicon.ico") %>" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />
    <%: Styles.Render("~/Content/css") %>
    <%: Scripts.Render("~/bundles/modernizr") %>
    <%: Scripts.Render("~/bundles/jqueryval") %>
    <script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.unobtrusive-ajax.js" type="text/javascript"></script>
</head>

Solution

  • Are you getting any errors in the javascript console?

    You can check the javascript console using F12 in Chrome and Firebug (Firefox plugin)