Got a static var which is working, now need to get dynamic var which isnt working
- by Ritz
got this variable
var zvmlist = {
'Huishoudelijke hulp': 'Huishoudelijke hulp',
'Verpleging thuis': 'Verpleging thuis',
'Verzorging thuis': 'Verzorging thuis',
'24 uurs zorg': '24 uurs zorg',
'Ondersteunende begeleiding': 'Ondersteunende begeleiding',
};
this var is used in a function to create a dropdownlist.
$.each(zvmlist, function(key, value) {
var selected='';
if(key==eventdata.title){var selected='selected' }
$('<option value="'+key+'" '+selected+'>'+value+'</option>').appendTo($('#calendar_edit_entry_form_title'));
});
which works lika a charm.
Now i created a function to fetch the list from a mysql table.
$.get('get_zorgvormen.php', function(data) {
var zvmlist = '{'+data+'}';
//alert(zvmlist);
});
when i enable the alert function it shows me the var(array).
But i it wont act as a variable.
How can i pass this data to my .each function?
see it in action here: http://www.zorgzuster-zeeland.nl/site/static/calendar_test.php