title: how to retrieve data from a Marklogic database when editing the generated source code?
body: <p>I want to edit the generated Marklogic source code by adding a select list for restricting search. The generated code is a javascript and the select list should contain information  retrieved from the database. I'm new to marklogic and i don't know how do so.</p>
  
  <p>The generated code:</p>
  
  <pre><code>'&lt;form name="query" id="query"&gt;'
      + '&lt;input type="text" id="query-text" value="" autocomplete="off" /&gt;'
      + '&lt;button type="submit" class="button" id="update- query"&gt;Search&lt;/button&gt;'
      + '&lt;/form&gt;'
      + '&lt;div id="search-suggestions"&gt;&lt;/div&gt;';
  </code></pre>
  
  <p>I want to add this code:</p>
  
  <pre><code>     &lt;p&gt;Choose a section: &lt;/p&gt;
       &lt;select name="sec-title" id="sec-title"&gt;
       &lt;option value="all"&gt;all&lt;/option&gt;
       {
       for $sec-title in fn:distinct-values(//a:sec-title/text())
       order by $sec-title
       return if($sec-title = xdmp:get-request-field("sec-title"))
       then &lt;option value="{$sec-title}" selected="selected"&gt; {$sec-title}  &lt;/option&gt;
       else &lt;option value="{$sec-title}"&gt; {$sec-title} &lt;/option&gt;
       }
       &lt;/select&gt;
  </code></pre>