Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Philip Christianto 20 posts 150 karma points
    Jan 25, 2017 @ 17:37
    Philip Christianto
    0

    Umbraco Ajax based site

    Im looking for a way to get the html of a node with template to render using ajax based query for example, when at home clicking a link /about/ will return an ajax of the html of about page

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        Layout = null;
    }
    <div class="about">
     /*about content from node about*/
    </div>
    

    so the ajax data will later give us

    <div class="about">
     Lorem ipsum dolor si amet
    </div>
    

    then i will render it to the placeholder front end of the website

    I know we can get the node id using

     UmbracoContext.Current.ContentCache.GetByRoute(string url)
    

    or

    uQuery.GetNodeByUrl
    
  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 26, 2017 @ 14:35
    Alex Skrypnyk
    100

    Hi Philip

    Try to use this method:

    library.RenderTemplate()
    

    Do not use "uQuery" in any case, it will be deprecated. Hope it will help you.

    Thanks,

    Alex

  • Philip Christianto 20 posts 150 karma points
    Jan 26, 2017 @ 16:50
    Philip Christianto
    0

    thanks for the solution works perfectly!

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 26, 2017 @ 16:59
    Alex Skrypnyk
    1

    Glad to help, have a nice evening!

    /Alex

Please Sign in or register to post replies

Write your reply to:

Draft