How to get selected term ID from drop down while ajaxing? I can't get name or ID from selected drop down during ajaxing. I was trying with code below:

if(isset($form_state['values']['submitted']['company_name'])){
    $company_ID = $form_state['values']['submitted']['company_name'];
    $form['submitted']['company_name']['#value'] = $company_ID;
}


Why is $company_ID empty?
I wasted too much time on this tiny task. However, I have done what I wanted.

Actually, I had to add $form_state['rebuild'] = TRUE; in my callback_function.

if(isset($form_state['values']['submitted']['company_name'])){
    $array_id[0] = $form_state['input']['company_name']; //$form_state['input']['company_name'] array holding the number I wanted.
    $company_ID = $array_id[0];
    $form['submitted']['company_name']['#value'] = $company_ID;
}