MvcSiteMapProvider with ajax

2

So I'm trying to set up a menu through ajax requests using the MvcSiteMapProvider, but when I try to access my CurrentNode in my ajax request, it's giving as null

My ajax request

$.ajax({
                url: '@Url.Action("MenuVisoes", "Menu", new { area = ""})',
                contentType: 'application/html; charset=utf-8',
                type: 'GET',
                dataType: 'html'
            })
                .success(function (result) {
                    $('#menuVisoes').html(result);
                });
        });

My action

public ActionResult MenuVisoes()
        {

            var currentNode = MenuHelper.GetCurrentNode(MvcSiteMapProvider.SiteMaps.GetSiteMap());
            //buscar no banco os submenus para o centro de trabalho atual

            if (Request.IsAjaxRequest())
            {
                return PartialView("_MenuVisoes", dados);
            }
            else
            {
                return View("_MenuVisoes", dados);
            } 
        }

I've already tried to get the CurrentNode so also MvcSiteMapProvider.SiteMaps.Current.CurrentNode , but it's always returning null However, if I put it this way in my view, it shows my current node right.

    
asked by anonymous 04.05.2015 / 22:29

0 answers