Got a static var which is working, now  need to get dynamic var which isn't working
<p>I've got this variable:</p>

<pre><code> var zvmlist = { 
   'Huishoudelijke hulp': 'Huishoudelijke hulp', 
   'Verpleging thuis': 'Verpleging thuis',
   'Verzorging thuis': 'Verzorging thuis',
   '24 uurs zorg': '24 uurs zorg',
   'Ondersteunende begeleiding': 'Ondersteunende begeleiding',
 }; 
</code></pre>

<p>this <code>var</code> is used in a function to create a drop-down list:</p>

<pre><code>    $.each(zvmlist, function(key, value) { 
  var selected='';
  if(key==eventdata.title){var selected='selected' }
  $('&lt;option value="'+key+'" '+selected+'&gt;'+value+'&lt;/option&gt;').appendTo($('#calendar_edit_entry_form_title')); 
  });
</code></pre>

<p>which works like a charm.</p>

<p>Now I created a function to fetch the list from a MySQL table:</p>

<pre><code> $.get('get_zorgvormen.php', function(data) {

    var zvmlist = '{'+data+'}';
    //alert(zvmlist);

  });
</code></pre>

<p>When I enable the alert function, it shows me the <code>var(array)</code>.</p>

<p>But I it won't act as a variable.</p>

<p>How can I pass this data to my <code>.each</code> function?</p>

<p>(You can see it in action here: <a href="http://www.zorgzuster-zeeland.nl/site/static/calendar_test.php" rel="nofollow">http://www.zorgzuster-zeeland.nl/site/static/calendar_test.php</a>.)</p>

<hr>

<pre><code> $.each(zvmlist, function(key, value) { 
        var selected='';
        if(key==eventdata.title){var selected='selected' }
        $('&lt;option value="'+key+'" '+selected+'&gt;'+value+'&lt;/option&gt;').appendTo($('#calendar_edit_entry_form_title')); 
        });
</code></pre>

<p>when the var zvmlist= currently</p>

<pre><code>var zvmlist = { 
      'Huishoudelijke hulp': 'Huishoudelijke hulp', 
      'Verpleging thuis': 'Verpleging thuis',
      'Verzorging thuis': 'Verzorging thuis',
      '24 uurs zorg': '24 uurs zorg',
      'Ondersteunende begeleiding': 'Ondersteunende begeleiding',
    }; 
</code></pre>

<p>but i want to get it populated by:</p>

<pre><code>$.get('get_zorgvormen.php', function(data) {
      //data = {"key":"value"};
      var obj = {};
      obj[0] = data;
      var zvmlist = '{'+obj[0]+'}';
      alert(zvmlist);
    });
</code></pre>

<p>When i delete the static var  the app breaks and wont populate the dropdown</p>

<hr>

<p>I combined both functions, it is kind of working except, the dropdownlist is populated with each letter from the var.</p>

<p>like</p>

<pre><code>&lt;option value="1"&gt;1&lt;/option&gt;
&lt;option value="2"&gt;'&lt;/option&gt;
&lt;option value="3"&gt; &lt;/option&gt;
&lt;option value="4"&gt;:&lt;/option&gt;
&lt;option value="5"&gt; &lt;/option&gt;
&lt;option value="6"&gt;'&lt;/option&gt;
&lt;option value="7"&gt;H&lt;/option&gt;
&lt;option value="8"&gt;u&lt;/option&gt;
</code></pre>

<p>and so on</p>

<pre><code>$.get('get_zorgvormen.php', function(data) {
      //data = {"key":"value"};
      var obj = {};
      obj[0] = data;
      var zvmlist = obj[0];  
     $.each(zvmlist, function(key, value) { 
        var selected='';
        if(key==eventdata.title){var selected='selected' }
        $('&lt;option value="'+key+'" '+selected+'&gt;'+value+'&lt;/option&gt;').appendTo($('#calendar_edit_entry_form_title')); 
        });
     });
</code></pre>

<p>any help will be appriciated</p>
