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!!