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)
      
894359Asked:
Who is Participating?
 
thirdCommented:
try,

setOmniValues('','','','contentmediatype=' + content_type_media + ',contentcategory=' + classification_category + ',contentbucket=' + classification_subcategory + ',contenttitle=' + content_type_title,'', '', 1)
     
0
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.