• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Eval variables in function call

I need to be able to set  the value of the variable in the string being passed. I can't break up the one parameter:

contentmediatype=content_type_media,contentcategory=classification_category,contentbucket=classification_subcategory,contenttitle=content_type_title


because it can be any number of assignments. The obvious issue is that I split out and eval the assignments but currently i don't get the values assigned to  content_type_media, classification_category etc. because it just makes the values "content_type_media" not the actual value (value1)!  How can I do this?

content_type_media = value1;
classification_category = value2;
                                        ...etc.
      setOmniValues('','','','contentmediatype=content_type_media,contentcategory=classification_category,contentbucket=classification_subcategory,contenttitle=content_type_title','', '', 1)
      
0
894359
Asked:
894359
1 Solution
 
ZvonkoSystems architectCommented:
I do not see your problem.
Compare to this:

<script>

content_type_media = 'value1';
classification_category = 'value2';
classification_subcategory = 'value3';
content_type_title ='value4';
                                     
     setOmniValues('','','','contentmediatype=content_type_media,contentcategory=classification_category,contentbucket=classification_subcategory,contenttitle=content_type_title','', '', 1)

function setOmniValues(a,b,c, theStatement){
  alert(theStatement);
  eval(theStatement);
  alert(contenttitle);

}
</script>

0
 
thirdCommented:
try,

setOmniValues('','','','contentmediatype=' + content_type_media + ',contentcategory=' + classification_category + ',contentbucket=' + classification_subcategory + ',contenttitle=' + content_type_title,'', '', 1)
     
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now