Updating values of a dropdown list with javascript

Hi there,

In a form view, I have some javascript function which returns two arrays as the result. I update values of my form after some calculation with values of one array. I wish to update a variable ($room) which is a dropdown list on my form.

Here is my code:




...

...




				$.get("index.php?r=reservation/Calcul", {brd: $("#brd").val(),rmtype: $("#rmtype").val(), nbr:nombre, dt:$("#arr").val() }, function(data) 

				{

					var amt = nb*data.prix;

					adad = $("#add_ad").val();

					adch = $("#add_ch").val();

					amt = amt+(nb*adad*data.prixadd)+(nb*adch*data.prixadd/2);

					$("#amt").val(amt);

					var myarr = data.test;

					$("#test").val(myarr);

				},"json");

			}

	}

	);');

?>

...

...

...


		<?php echo $form->dropDownList($model,'room',$room);?>



I wish to update the values of $room with the values of the array data.test returned by the javascript function. Can anyone please help me? Thanks