0

I have a parsed JSON which looks like this

{
    "pageName":"dsfdsf:sdfdsf:home",
    "prop1":"dsf:dsf","prop46":"OD",
    "prop5":"/content/",
    "prop24":"A Taste Of Home",
    "prop6":"1c4074ca-89bf-4d9f-8bd2-a5dc5f3ecf74",
    "prop3":"Home",
    "prop70":"dsf",
    "prop4":"dsf",
    "prop71":"desktop",
    "prop10":["dsfdsf"],
    "prop11":["sdfdsf"],
    "channel":"dsf"
} 

I am able to extract the key and value from this. I want to then set this map as JS variables in my script tag like

<script type="text/javascript">
     s.channel ="dsf"  // i need the prefix to be s. always and the variable should be set as s.key=value;
</script>

When i do s.key=value nothing happens. I have tried defining s as JS object as well but without joy. I want to pass these values to Tracking server so the variable name needs to be s.

The below works

if(key==="channel"){
s.channel = value // this works

but s.key=value doesn't.

shadow
  • 21,823
  • 4
  • 63
  • 77
Sam Thadhani
  • 585
  • 1
  • 10
  • 21

0 Answers0