Instead of using 'inline' with drupal_add_js(), consider using 'setting' instead and passing it an array, which will be available in the same fashion as Drupal.settings.basePath. http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/6

On Mon, Dec 6, 2010 at 10:31 AM, Aldo Martinez Selleras <aldo@caonao.cu> wrote:
I'm creating a select box dynamically from JSON data, and setting up a
selected value in URL, but I have a problem.

http://...../gallery/2

My php code:
$selected = arg(1);

if ( $selected ) {
  drupal_add_js('var url_class = '. $selected, 'inline');
}


My javascript code:

$('#class-filter').addOption({'0':' -- ALL -- '},false);
$('#class-filter').ajaxAddOption(Drupal.settings.basePath +
'gallery/class',{},true, my_selectOption);

function my_selectOption(){
  $(this).selectOptions( '' + url_class + '', true );
}

var classification = $('#gallery-classification-filter').val();


The select box is created OK, and the value showed as selected is ==
url_class, but the value of the object still is 0.

The question:

Why classification value == 0??? must be == url_class!!


--
[ Drupal support list | http://lists.drupal.org/ ]