You are here

function activesearch_submit in Javascript Tools 5

File

activesearch/activesearch.module, line 92

Code

function activesearch_submit($form_id, $form_values) {
  $type = $form_values['module'] ? $form_values['module'] : 'node';
  if (in_array($form_id, array(
    'search_theme_form',
    'search_block_form',
  ))) {
    $keys = $form_values[$form_id . '_keys'];

    // We can't return a string that includes the keys. Instead
    // we set the destination directly.
    $_REQUEST['destination'] = 'search/' . $type . '#keys=' . $keys;
    return;
  }
  $keys = $form_values['processed_keys'];
  $_GET['q'] = 'search/' . $type . '/' . $keys;
  $_GET['page'] = $form_values['page'];
  print drupal_to_js(array(
    'status' => TRUE,
    'data' => array(
      'keys' => $keys,
      'results' => activesearch_results($keys, $type),
    ),
  ));
  exit;
}