Whats wrong with this function? .each related
Posted
by Ritz
on Stack Overflow
See other posts from Stack Overflow
or by Ritz
Published on 2010-04-08T16:33:26Z
Indexed on
2010/04/08
16:43 UTC
Read the original article
Hit count: 317
When I uncomment the alert the data is there... like:
{
'Huishoudelijke hulp': 'Huishoudelijke hulp',
'Verpleging thuis': 'Verpleging thuis',
'Verzorging thuis': 'Verzorging thuis',
'24 uurs zorg': '24 uurs zorg',
'Ondersteunende begeleiding': 'Ondersteunende begeleiding',
}
But instead of populating the key and the value it takes the whole var and start to create a key and value pair for each character.
You can see this in action here: http://www.zorgzuster-zeeland.nl/site/static/calendar_test.php
create a task in the calendar and then try to edit the task by clicking on it. It should populate the dropdown field properly.
When i create a static var with the same values the dropdown works.
static 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 is my function, anybody has a clue?
$.get('get_zorgvormen.php', function(zvmlist) {
//alert("Data Loaded: " + zvmlist);
$.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'));
});
});
© Stack Overflow or respective owner