Im a newbie in web development and I really need some help.I want to show a html table using ajax. This codes are from two different files. Am i doing this right??
here is my index.html
<html>
    <body>
<script>
function loadXMLDoc()
{
    var xmlhttp;
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET","table.php",true);
    xmlhttp.send();
}
</script>
        <form action = "insert.php" method="post">
        Firstname: <input type="text" name="firstname"></br>
        Lastname: <input type="text" name="lastname"></br>
        Middlename: <input type="text" name="middlename"></br>
        <input type="submit" onclick="loadXMLDoc()">
        </form>
        <div id="myDiv"></div>
    </body>
</html>
here is my table.php. When i click the submit button nothing happens. Is there someone who can tell me if Im doing this right??
<html>
    <body>
        <table border = 1>
            <tr>
                <th>FIRSTNAME</th>
                <th>LASTNAME</th>
                <th>MIDDLENAME</th>
                <th>DELETE</th>
            </tr>
    /*  <?php
                $con = mysqli_connect("localhost","root","","study");
                if (mysqli_connect_errno($con))
                    {
                        echo "Failed to connect to mysql" . mysqli_connect_error();
                    }
                    $result = mysqli_query($con,"SELECT * FROM sample_employers");
                    while($row=mysqli_fetch_array($result))
                    {
                        echo "<tr>";
                        echo "<td>" . $row['firstname'] . "</td>";
                        echo "<td>" . $row['lastname'] . "</td>";
                        echo "<td>" . $row['middlename'] . "</td>";
                        echo "<td> <input type='button' value='Delete' </td>"; 
                        echo "</tr>";
                    }
                    mysqli_close($con);
            ?>
        </table>
        </body>
</html>
 
     
     
    