title: showing php jsonencode array result into ajax success function
body: <p>I am trying to show result of my php code to ajax file with jquery but I don't know how to do it. Final array <code>[{"UPDATE_TIME":"2016-11-28 06:51:51"}]</code> </p>
  
  <p>I want to show this result through ajax jquery. </p>
  
  
  
  <pre><code>&lt;?php
  header('Access-Control-Allow-Origin: *');
  
  include_once "dbconfig.php";
  
  $sql = "SELECT UPDATE_TIME
  FROM   information_schema.tables
  WHERE  TABLE_SCHEMA = 'vizteyl7_tarining'
     AND TABLE_NAME = 'news'";
  
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
      // output data of each row
      while($row = $result-&gt;fetch_assoc()) {
          $output[] = $row;
      }
  
      echo json_encode($output);
  } else {
      echo "0 results";
  }
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  
  
  <pre><code> &lt;label&gt;Enter TimeStamp (last updated date: &lt;span id="lastTs"&gt;&lt;/span&gt;)&lt;/label&gt;
  </code></pre>
  
  
  
  <pre><code>    $(document).ready(function(){
                setTs();
        })
  
    function setTs(){
  
    $.ajax({
          type: "GET",
          url:"http://example.com/stshow.php",
          dataType: "json",
          success: function(data) {
              $('#lastTs').text(data[0]);
  
  }
  });
  }
  </code></pre>