According to the documentation of #ajax['callback'], the callback function defined by this property "can return HTML, a renderable array, or an array of AJAX Commands."
This issue is about that last statement, that the callback function can return an array of AJAX commands. This would mean the following:
return array(
ajax_command_replace($selector1, $html1),
ajax_command_html($selector2, $html2),
);
This, in fact, doesn't work, and no error message is produced. After hours of debugging and reading documentation, I found the solution in the source code of ajax_prepare_response(). The code of the callback function should do this:
return array(
'#type' => 'ajax',
'#commands' => array(
ajax_command_replace($selector1, $html1),
ajax_command_html($selector2, $html2),
),
);
How can we reflect this in the documentation? I'm not sure if it is appropriate to put this information in that same paragraph.