Giving ajax call response as lighbox.section options

Hi,

 I have the following ajax call:

 var services = $.ajax({
        url: "../services/getservices",
        async: false,
        dataType: "json"
}).responseText;

 which give me the following json object:

 [{"key":"2","label":"Limipieza Bucal"},{"key":"3","label":"Primera Visita"},{"key":"4","label":"Periodoncia"}]

 Then I use the "services" variable as the value for my "service" section in the scheduler.config.lightbox.sections as follows:

 scheduler.config.lightbox.sections=[
    {name:"contact", height:20, map_to:"contact", type:"textarea"},
    {name:"service", height:21, type:"select", map_to:"service", options: services},
    {name:"description", height:100, map_to:"text", type:"textarea" , focus:true},
    {name:"time", height:72, type:"time", map_to:"auto"},
]

 The problem is that the select "services" is renered with a lot of "undefined" values which is not the expected result. Are my steps correct?

Thanks
Aleix Vergés

Hi,

 I could solve my problem. I missed "eval(services)" before give as on option.

 Thanks

Aleix Vergés

Hey, had the same problem, my code:

var listgroups=sendRequestGet(“processAjax.php”,“actevent=11&t=0&lx=<?php echo($ID_LOGGED);?>”,“no_control”,0);
var groups=eval(listgroups);

…in fact, the ‘eval’ has save(and solved) my problem =)

thanks