Call a Javascript Function and Update my Form Element at the same time
Just to ad to the above answer by Ollie.
To return form['id'] too (same as the default behavior), you can use ajax_command_replace

function myid_search_idnumber($form, $form_state){
    $commands[] = ajax_command_replace(NULL, render($form['id']));
    $commands[] = ajax_command_invoke(NULL, 'myid_update_id_number', array($form['id'])); 
    $page = array( 
         '#type' =&gt; 'ajax', 
         '#commands' =&gt; $commands, 
      ); 
    ajax_deliver($page);
  }