Copied to clipboard

Flag this post as spam?

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


  • Urvish 252 posts 776 karma points
    Apr 29, 2015 @ 07:49
    Urvish
    0

    How to get Umbraco content node in Javascript

    Hi,

    I am using Umbraco 7.2.4.

    I need to get a Umbraco content node in Javascript file. So that I can get properties of it.

    How can I do that?

    Can any one have idea?

    Thanks in advance.

    Regards,

    Urvish Mandaliya

  • Urvish 252 posts 776 karma points
    Apr 29, 2015 @ 07:57
    Urvish
    0

    My aim is to get value from view to javascript or else if I can access Umbraco node in Javascript than I can fetch node properties.

  • Urvish 252 posts 776 karma points
    Apr 29, 2015 @ 08:55
    Urvish
    100

    Hi,

    After little bit of workaround I managed to get value in Javascript.

    What I did is:

    1. make a property in my custom model
    2. set that property from controller using IPublishedContent node = UmbracoContext.Current.ContentCache.GetByRoute("/requestquoteemailtemplate/"); string mailHtml = node.GetPropertyValue("emailTemplateHtml").ToString();
    3. set window.currentTemplateModel with my custom model in View
    4. get property in javascript like this : window.currentTemplateModel.raqEmailTemplateHtml

    May it can help anyone to solve this kind of issue.

    Regards,

    Urvish Mandaliya

Please Sign in or register to post replies

Write your reply to:

Draft