title: Unable to display in right format - PHP CodeIgniter
body: <p>My Controller Function</p>
  <pre><code>public function fetchAllCategory() {
      $resultlist = $this-&gt;BlogModel-&gt;fetchData('*', 'blogcategory', array());
      $result = array();
      $i = 1;
  
      foreach ($resultlist as $key =&gt; $value) {
          $result['data'][] = array(
            $i++,
            $value['Category'],
            '&lt;a class=&quot;btn btn-info&quot; href=&quot;#&quot; title=&quot;Edit Category&quot; onClick=&quot;editCategory(&quot;' . $value['Category'] . '&quot;)&quot;&gt;&lt;i class = &quot;fas fa-edit&quot;&gt;&lt;/i&gt;&lt;/a&gt; '
            . '&lt;a class = &quot;btn btn-danger&quot; href = &quot;' . base_url('Blog/deleteCategory/') . $value['catId'] . '&quot; onClick = &quot;return confirm(\'are you sure you want to delete?\');&quot;&gt;&lt;center&gt;&lt;i class = &quot;fa fa-trash-alt&quot;&gt;&lt;/i&gt;&lt;/center&gt;&lt;/a&gt;'
          );
      }
      echo json_encode($result, JSON_PRETTY_PRINT);
      //' . base_url('Blog/editCategory/') . $value['catId'] . '
  }
  </code></pre>
  <p>My View (Inspect Element )</p>
  <pre><code>&lt;a class=&quot;btn btn-info&quot; href=&quot;#&quot; title=&quot;Edit Category&quot; onclick=&quot;editCategory(&quot; business&quot;)&quot;=&quot;&quot;&gt;&lt;svg class=&quot;svg-inline--fa fa-edit fa-w-18&quot; aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;fas&quot; data-icon=&quot;edit&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 576 512&quot; data-fa-i2svg=&quot;&quot;&gt;&lt;path fill=&quot;currentColor&quot; d=&quot;M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;!-- &lt;i class=&quot;fas fa-edit&quot;&gt;&lt;/i&gt; Font Awesome fontawesome.com --&gt;&lt;/a&gt;
  </code></pre>
  <p>I want to perform onClick functionality using Anchor tab, But I am facing issues.
  As below screen If I click any Category edit button then It will fill the value in left text box.</p>
  <p>for the Last Category &quot;16&quot; I am not getting any issue but when I am failed with any string.
  <a href="https://i.stack.imgur.com/tknr4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tknr4.png" alt="Dashboard" /></a></p>
  <p>My JavaScript Code</p>
  <pre><code>function editCategory($id) {
          document.getElementById(&quot;category&quot;).value = $id;
          console.log($id)
      }
  </code></pre>