title: How to show php responsed data in html table
body: <p>I am trying to getting a .json file from another  server and want to show .json file in a html table. php code is successfully  returning json. But my problem is that i want to view this in a table because i am not able to implement php result in javascript when i will click on button named Get Data</p>
  
  <p>Here is my .php file</p>
  
  <pre><code>&lt;html&gt;
  &lt;header&gt;
      &lt;title&gt;Hello
      &lt;/title&gt;
      &lt;/header&gt;
  &lt;body&gt;
  
  
  &lt;!--javascript make append table data--&gt;
  
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"&gt; &lt;/script&gt;
  
  &lt;script&gt;
  
      $(function() {
  
  
  
     $.getJSON('$result.json', function(data) {
         $.each(data.videoLectureListing, function(i, f) {
            var tblRow = "&lt;tr&gt;" + "&lt;td&gt;" + f.Id + "&lt;/td&gt;" +
             "&lt;td&gt;" + f.videoName + "&lt;/td&gt;" + "&lt;td&gt;" + f.date + "&lt;/td&gt;" + "&lt;td&gt;" + f.time + "&lt;/td&gt;" + "&lt;td&gt;" + f.video + "&lt;/td&gt;" + "&lt;td&gt;" + f.image + "&lt;/td&gt;" +
             "&lt;td&gt;" + f.videoDuration + "&lt;/td&gt;" + "&lt;td&gt;" + f.liveStatus + "&lt;/td&gt;" + "&lt;td&gt;"+ "&lt;/tr&gt;"
             $(tblRow).appendTo("#userdata tbody");
       });
  
     });
  
  });
  &lt;/script&gt;
  
  
  
  
  &lt;!--javascript  append table data ended --&gt;
  
  
  &lt;!-- user form --&gt;
  &lt;form method='POST'&gt;
      &lt;input type='hidden' name='formSubmitted' value=1&gt;
  
      &lt;label for="userId"&gt;&lt;b&gt;UserId&lt;/b&gt;&lt;/label&gt;
      &lt;input type="number" placeholder="Enter Your User Id" name="userId" autofocus required&gt;
  
      &lt;label for="categoryId"&gt;&lt;b&gt;categoryId&lt;/b&gt;&lt;/label&gt;
      &lt;input type="number" placeholder="Enter categoryId" name="categoryId" required&gt;
  
      &lt;button type="submit" &gt;GET DATA&lt;/button&gt;
  &lt;/form&gt;
  &lt;!-- user form --&gt;
  
  
  
  &lt;!--table--&gt;
  
  &lt;div class="wrapper"&gt;
  &lt;div class="profile"&gt;
     &lt;table id= "userdata" width="100%" border="5"&gt;
    &lt;thead&gt;
              &lt;th&gt;VIDEO NAME&lt;/th&gt;
              &lt;th&gt;DATE&lt;/th&gt;
              &lt;th&gt;TIME&lt;/th&gt;
              &lt;th&gt;DURACTION&lt;/th&gt;
              &lt;th&gt;LINK &lt;/th&gt;
          &lt;/thead&gt;
        &lt;tbody&gt;
  
         &lt;/tbody&gt;
     &lt;/table&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;!--table data end--&gt;
  
  
  
  &lt;!---php file start--&gt;
  &lt;?php
  
  $userId = $_POST['userId'];
  $categoryId = $_POST['categoryId'];
  
  if (isset($_POST['formSubmitted'])) {
  
  $url = 'https://www.otherserver.php';
  $data = array('userId' =&gt; $userId, 'categoryId' =&gt; $categoryId);
  
  // use key 'http' even if you send the request to https://...
  $options = array(
      'http' =&gt; array(
          'header'  =&gt; "Content-type: application/x-www-form-urlencoded\r\n",
          'method'  =&gt; 'POST',
          'content' =&gt; http_build_query($data)
      )
  );
  $context  = stream_context_create($options);
  $result = file_get_contents($url, false, $context);
  if ($result === FALSE) { /* Handle error */ }
  
  echo ($result);
  //json_encode($result, true);
  }
  ?&gt;
  
  
  &lt;!---php file ended    
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>