title: Split array values in javascript+codeigniter
body: <p><img src="https://i.stack.imgur.com/nTh5s.png" alt="i have attached the screenshot of my output. Now its an array format, i want to split those array values from javascript. "></p>
  
  <p>View File:</p>
  
  <pre><code>&lt;form name="sortdata" method="POST" action="&lt;?php echo base_url;?&gt;home/sortby"&gt;
  &lt;select id="sortMyData" name="sortMyData" class="sortMydata"&gt;
      &lt;option value="lowhigh"&gt;Low to high price&lt;/option&gt;
      &lt;option value="highlow"&gt;High to low price&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="hidden" id="baseurl" name="baseurl" value="&lt;?php echo base_url;?&gt;"&gt;
  &lt;/form&gt;
  
  &lt;div id="sortbyprice" class="span6"&gt;
  
  
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function()
  {
      $(".sortMydata").change(function()
  {
  var baseurl=$("#baseurl").val();
  var sortMyData=$("#sortMyData").val();
  //alert(baseurl);
  alert(sortMyData);
  $.ajax
  ({
  type:"GET",
  url:baseurl + 'product/sortbydetails/' + sortMyData,
  //data:this.value,
  cache: false,
  success:function(html)
      { 
          var length=html.length;
          alert(html);
          alert(html[0]); 
  
      }
  });
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public function sortbydetails()
      {
          $lowhigh=$this-&gt;uri-&gt;segment(3);
          if($lowhigh=="lowhigh")
          {
              $lowtohighprice=$this-&gt;product_model-&gt;getlowtohighprice();  
              $count=count($lowtohighprice);
              //echo $count;
  
              for ($i=0; $i &lt; $count ; $i++) 
                  { 
  
                      foreach ($lowtohighprice as $key =&gt; $value) {
                      $sortby[] = array_values($value);
  
                  }
                      print_r($sortby);
              }
              //print_r($lowtohighprice);
          }
          else
          {
              $hightolowprice=$this-&gt;product_model-&gt;gethightolowprice();
              //print_r($hightolowprice);
          }
  
      }
  </code></pre>
  
  <p>I am trying to split the array values from javascript. I wrote an jquery ajax code and display the output in a div. Now am getting the output as an array values, i want to split that array values. I spend a whole day to achieve this task, but i couldnt able to resolve. </p>