Submitting post between ajax and php

I’m a newbie in the world of php and I was trying to learn it with a simple page.
I’ve created an html form and I want to send data using ajax but it still
POST http://localhost/Home.php 500 (Internal Server Error)

In particular I want to create a button for every table in a database which I’m using for testing, when I push a button it will show all lines from the database (I’ve not implemented it yet, I’m only trying to understend how php and ajax communicate)

This is my form (Home.php)

<div id="displayForm">

<form method="post" id="selectForm">
        include ("Database.php");

        $Database = new Database( "localhost", "root", "1234");
        $Tables = $Database->countTable();
        foreach($Tables as $column) {
            echo "<input type="radio" class="submit" id="selectQuery" name="selectQuery" value="". $column . ""> " .  $column;
    <input type="submit" class="submit" name="createSelect">
</form> </div>

The php in the form is only for create the button with the name of the tables.

In the same file (Home.php)

 include 'ChromePhp.php';
echo "ok";

In the file Home.php, in the head section I’ve included all jquery library and the js file

<script src='jquery-1.10.2.min.js'></script>
<script src='Script.js'></script>

And this is my ajax file

    function() {

function goCreate(data) {

function goDisplay(data) {

function goSelect() {
    var selectedTable = $("#selectQuery:checked").val();

        url: "Home.php",
        type: "POST",
        dataType: "html",
        data: {
            'select': 'display',
            'table': selectedTable
        success: function(msg) {
        error: function(xhr, desc, err) {
            console.log("Details: " + desc + "nError:" + err);

    }); // end ajax call
    return false;

Source: ajax

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.