title: Trying to make a submit button in another file update a table in another file without refreshing the page
body: <p><img src="https://i.stack.imgur.com/F8FB0.png" alt="My Webpage"></p>
  
  <p>Here are my three classes:
  This class is where i combine the other two classes.  When i press submit i was the table on the right to update without refreshing.</p>
  
  <pre><code>        &lt;!DOCTYPE html&gt;
      &lt;html&gt;
          &lt;head&gt;
              &lt;title&gt;BugDisplayAndReport&lt;/title&gt;
              &lt;script src = "jquery.js"&gt;&lt;/script&gt;
              &lt;script&gt;
                  $(document).ready(function(){
                      $.post('BugReport.html',{},function(data){
                          $("#BugReport").html(data);
                      });
                  });
                  $(document).ready(function(){
                      $.post('BugDisplay.php',{},function(data){
                          $("#BugDisplay").html(data);
                      });
                  });
              &lt;/script&gt;
          &lt;/head&gt;
          &lt;body&gt;
              &lt;div id = "BugReport"&gt;&lt;/div&gt;
              &lt;div id = "BugDisplay"&gt;&lt;/div&gt;
          &lt;/body&gt;
      &lt;/html&gt;
  
  Here is the Issue Report code, i am not going to use the "location.reload(true)" to do what i want because i would the the page to update without refreshing:
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;IssueReport&lt;/title&gt;
          &lt;script src = "jquery.js"&gt;&lt;/script&gt;
          &lt;style&gt;
              body{
                  padding:0;
                  margin:0;
              }
              #box {
                  padding: 5px;
                  color:black;
                  margin: 0 auto;
                  border-style: solid;
                  border-color: black;
                  border-width: 1px;
                  width: 162px;
                  float: left;
              }
          &lt;/style&gt;
          &lt;script&gt;
              $(document).ready(function(){
                  $("#sub").click(function(){
                      var user_issue = $("#issue").val();
                      var user_priority = $("#priority").val();
                      var user_type = $("#type1").val();
                      $.post("BugReport.php",{issue:user_issue,priority:user_priority,type1:user_type},function(data){
                          $("#result").html(data);
                          //location.reload(true);
                      });
                  });
              });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="box"&gt;
          &lt;h3 style = "margin:10px 30px 30px 30px"&gt;Issue Report&lt;/h3&gt;
          &lt;form action="BugReport.html" method="post"&gt;
          &lt;textarea cols="20" rows="18" name="issue" id = "issue" placeholder = "Enter Your Issue Here" "&gt;&lt;/textarea&gt;&lt;/form&gt;&lt;br&gt;
          &lt;div style = "width: 100px; margin-left: auto; margin-right: auto"&gt;Type Of Issue:&lt;/div&gt;
              &lt;div style = "width: 150px; margin-left: auto; margin-right: auto; padding: 2px"&gt;
              &lt;form action="BugReport.html" method="post"&gt;
              &lt;select name = "type1" id = "type1"&gt;
                  &lt;option value = "Listing Discrepancy"&gt;Listing Discrepancy&lt;/option&gt;
                  &lt;option value = "PO Discrepancy"&gt;PO Discrepancy&lt;/option&gt;
                  &lt;option value = "Pricing Discrepancy"&gt;Pricing Discrepancy&lt;/option&gt;
                  &lt;option value = "Program Glitch"&gt;Program Glitch&lt;/option&gt;
                  &lt;option value = "Receiving Discrepancy"&gt;Receiving Discrepancy&lt;/option&gt;
                  &lt;option value = "RMA Discrepancy"&gt;RMA Discrepancy&lt;/option&gt;
                  &lt;option value = "Sales Discrepancy"&gt;Sales Discrepancy&lt;/option&gt;
                  &lt;option value = "Shipping Discrepancy"&gt;Shipping Discrepancy&lt;/option&gt;
              &lt;/select&gt;
              &lt;/form&gt;&lt;/div&gt;
              &lt;div style = "width: 50px; margin-left: auto; margin-right: auto"&gt;Priority:&lt;/div&gt;
              &lt;div style = "width: 70px; margin-left: auto; margin-right: auto; padding: 2px"&gt;
              &lt;form action="BugReport.html" method="post"&gt;
              &lt;select name = "priority" id = "priority"&gt;
                  &lt;option value = "Low"&gt;Low&lt;/option&gt;
                  &lt;option value = "Regular" selected&gt;Regular&lt;/option&gt;
                  &lt;option value = "High"&gt;High&lt;/option&gt;
                  &lt;option value = "Urgent"&gt;Urgent&lt;/option&gt;
              &lt;/select&gt;
              &lt;/form&gt;&lt;/div&gt;
          &lt;div style = "width: 50px; margin-left: auto; margin-right: auto; padding: 2px"&gt;
          &lt;input type ="submit" name = "sub" value = "Submit" id = "sub"&gt;&lt;/div&gt;
          &lt;div id="result"&gt;&lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the code that creates the table on the right:</p>
  
  <pre><code>&lt;?php
      $servername = "localhost";
      $username = "username";
      $password = "password";
      $database = "database";
  
      $con = mysqli_connect($servername,$username,$password,$database);
  
      if($con-&gt;connect_error){
          die("Connection failed " . $con-&gt;connect_error);
      }
  
      $strSQL = "SELECT * FROM BugReport where priority = 'Urgent'";
      $strSQL1 = "SELECT * FROM BugReport where priority = 'High'";
      $strSQL2 = "SELECT * FROM BugReport where priority = 'Regular'";
      $strSQL3 = "SELECT * FROM BugReport where priority = 'Low'";
      $rs = mysqli_query($con,$strSQL);
      $rs1 = mysqli_query($con,$strSQL1);
      $rs2 = mysqli_query($con,$strSQL2);
      $rs3 = mysqli_query($con,$strSQL3);
      $i = 0;
      echo "&lt;table style = 'float: left; position: relative; left:160px; border: 1px; border-style:solid; border-collapse: collapse;'&gt;&lt;tr&gt;
      &lt;th style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;Priority&lt;/th&gt;
      &lt;th style = 'border: 1px; border-style:solid; border-collapse: collapse'&gt;Issue Category&lt;/th&gt;
      &lt;th style = 'border: 1px; border-style:solid; border-collapse: collapse;width: 300px'&gt;Issue&lt;/th&gt;
      &lt;th style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;Date&lt;/th&gt;&lt;/tr&gt;";
      while($row = mysqli_fetch_array($rs)){
          if(($i % 2) == 0){
              echo '&lt;tr style="border: 1px; background:#CCFF33; color: black"&gt;';
          }else {echo '&lt;tr style="border: 1px; background:white; color: black"&gt;';}
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['priority'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['type1'] . "&lt;/td&gt;";
          echo "&lt;td style = 'word-break:keep-all;width: 300px; border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['issue'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['date'] . "&lt;/td&gt;";
          echo '&lt;/tr&gt;';
          $i = $i + 1;
      }
      while($row = mysqli_fetch_array($rs1)){
          if(($i % 2) == 0){
              echo '&lt;tr style="border: 1px; background:#CCFF33; color: black"&gt;';
          }else {echo '&lt;tr style="border: 1px; background:white; color: black"&gt;';}
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['priority'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['type1'] . "&lt;/td&gt;";
          echo "&lt;td style = 'word-break:keep-all;width: 300px; border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['issue'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['date'] . "&lt;/td&gt;";
          echo '&lt;/tr&gt;';
          $i = $i + 1;
      }
      while($row = mysqli_fetch_array($rs2)){
          if(($i % 2) == 0){
              echo '&lt;tr style="border: 1px; background: #CCFF33; color: black"&gt;';
          }else {echo '&lt;tr style="border: 1px; background:white; color: black"&gt;';}
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['priority'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['type1'] . "&lt;/td&gt;";
          echo "&lt;td style = 'word-break:keep-all;width: 300px; border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['issue'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['date'] . "&lt;/td&gt;";
          echo '&lt;/tr&gt;';
          $i = $i + 1;
      }
      while($row = mysqli_fetch_array($rs3)){
          if(($i % 2) == 0){
              echo '&lt;tr style="border: 1px; background:#CCFF33; color: black"&gt;';
          }else {echo '&lt;tr style="border: 1px; background:white; color: black"&gt;';}
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['priority'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['type1'] . "&lt;/td&gt;";
          echo "&lt;td style = 'word-break:keep-all;width: 300px; border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['issue'] . "&lt;/td&gt;";
          echo "&lt;td style = 'border: 1px; border-style:solid; border-collapse: collapse;'&gt;" . $row['date'] . "&lt;/td&gt;";
          echo '&lt;/tr&gt;';
          $i = $i + 1;
      }
      echo "&lt;/table&gt;";
  ?&gt;
  </code></pre>