: " js "
:
:
$form['letterdrop_id'] = array(
'#type' => 'select',
'#title' => 'Letterdrops',
'#options' => $letterdrops,
'#prefix' => '<div id="replace_div_ld">',
'#suffix' => '</div>',
'#ajax' => array(
'callback' => 'agc_ems_form_map_change',
),
);
:
function agc_ems_form_map_change($form, &$fstate) {
return array(
'#type' => 'ajax',
'#commands' => array(
ajax_command_replace("#agc_map", render($form['map'])),
array('command' => 'afterAjaxCallbackExample',
'selectedValue' => 'i am not a fish',
)
));
}
js
(function($, Drupal) {
Drupal.ajax.prototype.commands.afterAjaxCallbackExample =
function(ajax, response, status) {
alert(response.selectedValue);
};
}(jQuery, Drupal));
100% jaypan