Eval variables in function call

Posted on 2006-05-15
Last Modified: 2008-03-10
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:


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;
      setOmniValues('','','','contentmediatype=content_type_media,contentcategory=classification_category,contentbucket=classification_subcategory,contenttitle=content_type_title','', '', 1)
Question by:894359
    LVL 63

    Expert Comment

    I do not see your problem.
    Compare to this:


    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){


    LVL 30

    Accepted Solution


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

    Featured Post

    Hire Freelancers to Complete JavaScript Projects

    Source the talented Expert Exchange community
    for top quality work on your JavaScript projects.

    Hire the best. Collaborate easily. Get quality work.

    Join & Write a Comment

    Suggested Solutions

    A common challenge, or question, when working with two calendar dates is: What is the difference between the specified days? As is frequently the case, the answer is: It depends... What kind of difference do you want? Given two date obje…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now