I have one line in my could that's giving me a 500 internal err and it's my append to the dropdown list. I've tried $('#test').append(fillDataList(obj)); and jQuery('#test').append(fillDataList(obj));


<script runat="server">   
  Test Dropbox 8
<select id="test"></select>


  <script runat="server"> 
    var fillDataList = function( options )
      var items = '';
        $.each( options, function ( index, option ) {
            items += '<option value="' + option + '">'
            items += option
            items += '</option>'
            return items

var obj = { one: 'hey 1', two: 'hey 2', three: 'hey 3', four: 'hey 4', five: 'hey 5'};


  • The SFMC server-side JavaScript runs before the page loads, so keep that in mind. Looks like you're mixing client-side jQuery and SSJS. That won't work. Dec 30, 2016 at 4:36
  • Thanks for the clarification. Would you be able to point me in the right direction to getting this to work as ssjs. i haven't been able to find any examples that helps me understand. I'm a visual person I need to see some form of example to understand Dec 30, 2016 at 13:53

1 Answer 1


Here's how I've accomplished something similar in SSJS. The idea is that you build the Select HTML in a SSJS block and output it in the body of the page.

<script runat="server">


  var MONTHNAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  var monthSelect = "<select>";
  monthSelect += "<option value=''>Select Month</option>";

  for (var i = 0; i < MONTHNAMES.length; i++) {
     monthSelect += "<option value='"+MONTHNAMES[i]+"'>" +MONTHNAMES[i]+ "</option>";

  monthSelect += "</select>";


Month: <ctrl:eval>monthSelect</ctrl:eval>



month select

  • This is perfect thank you so much. Can you please explain <ctrl:eval> I came across this in the MC docs but didn't quit understand it Dec 30, 2016 at 17:21
  • Most of the good SSJS stuff is outlined on the SSJS Syntax Guide wiki page. Dec 30, 2016 at 20:35
  • Also, this answer has a good overview of the resources: salesforce.stackexchange.com/a/130337/5202 Dec 30, 2016 at 20:38
  • What if I want to replace the var MONTHNAME to equal an html page content. I tried %%[ set @JSON = HttpGET("insert URL here") ]%% but when printed out come out all garbaly goop. instead of the content on that json page which is [ " Child and Youth Worker ", " Energy Systems Engineering Technology ", " Digital Photography ",]; – Jan 1, 2017 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .