cant loop through array with ajax_command_html
Try with this: 

  $string = $form_state['values']['search_block_form'];

  $query = db_select('node', 'n');
  $query-&gt;join('field_data_body', 'b', 'n.nid = b.entity_id');

  $query
    -&gt;fields('n', array('nid', 'title'))
    -&gt;fields('b', array('entity_id', 'body_value'));

  $db_or = db_or();
  $db_or-&gt;condition('n.title', '%' . db_like($string) . '%', 'LIKE');
  $db_or-&gt;condition('b.body_value', '%' . db_like($string) . '%', 'LIKE');
  $query-&gt;condition($db_or);

  $results = $query
    -&gt;execute()
    -&gt;fetchAll(PDO::FETCH_ASSOC);

  $commands = [];

  foreach ($results as $result) {
    $node_title = $result['title'];
    $node_id = $result['nid'];
    $entity_id = $result['entity_id'];
    $body_text = $result['body_value'];
    $commands[] = ajax_command_html("#block-system-main", "&lt;h1&gt;" . $node_title . "&lt;/h1&gt; &lt;p&gt;" . $body_text . "&lt;/p&gt;");
  }
  return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);