Copied to clipboard

Flag this post as spam?

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


  • Severin 2 posts 22 karma points
    Apr 26, 2015 @ 13:30
    Severin
    0

    Macro Parameters in JavaScript?

    Ive been trying to get Macro Parameters in JavaScript with Razor for a few hours now, with no luck. Is it even possible? Havent been able to Google any answers so I thought Id ask here. Hope someone can help.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 26, 2015 @ 20:27
    Jan Skovgaard
    0

    Hi Severin

    Not sure I get the the context? What are you trying to achieve? You can generate JavaScript using some Razor code but it's mixing up things so you have some JavaScript logic in a Razor view file, which may not be nice...but sometimes that's of course the option one needs to go with for different reasons.

    A better approach could be to add some custom data-* attributes to some HTML elements, which you can use to expose some values that you can then fetch using JavaScript. But in order to be able to point you in the correct direction you'll need to elaborate a bit more on why, what and how you need to achieve it and perhaps share some of the code that you're currently trying to get to work.

    Looking forward to hearing from you.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft