7 – AJAX rebuild a single form element

I'm trying to run an AJAX-compatible form. Users should be able to switch from one field to the other using the keyboard, and when a user moves to the next element, I wish the name, after the Previous element, be updated via AJAX.

function my_form () {

...

$ form['entry_fieldset']['entry_ids'][]    = table (
& # 39; # type & # 39; => & # 39; textfield & # 39 ;,
& # 39; # field_suffix & # 39; => "John Doe"
& # 39; # ajax & # 39; => array (
& # 39; callback & # 39; => & # 39; _update_name_callback & # 39;
)
)

...

return $ form;
}

Above you can see that the range is after the text field and contains a name. AJAX will be called when the focus is lost. Since I only want the span to update, I try to use AJAX commands in the reminder:

function _update_name_callback ($ form, & $ form_state) {
$ id = $ state_format['triggering_element']['#id'];
$ entry = $ form_state['triggering_element']['#value'];

// update the name according to the value.
$ name = & # 39; New name & # 39 ;;

// Set the innerText of the span element.
// Call jQuery: $. (& # 39; Switch & # 39;). Text ('New Name');
$ orders[] = ajax_command_invoke ("# {$ id} + span.entry_name", & # 39; text & # 39; [[$name]])

return array (# type = ajax, # commands => $ commands);
}

But for some reason, updates do not display until the form is rebuilt. I'm pretty new to this field and I do not know what I'm doing wrong. I spent days on it.

I've also tried using & # 39; wrapper & # 39; => & # 39; entry-container & # 39 ;, & # 39; method & # 39; => & # 39; replace & # 39; where the container is on the element, but the problem is the same, and I'm not sure it would work anyway, because I'm editing something that is a field_suffix, not the actual text field.

What should I change so that the individual piece is updated at the moment, instead of waiting for it to be clicked on a send button? What am I doing wrong?