使用AJAX发布到PHP链接

I have been trying to use a wamp server with my html site. I want to add a row to a table but nothing seems to work. I am using ajax to post the data to the php file and then using sql commands to update the table.

HTML Code

<button type="submit" class="btn btn-lg btn-primary" onClick="PostJob();"> Submit </button>

Javascript code in HTML file:

    <script language="javascript">
    function PostJob() {
        $.ajax({
        type: "POST",
        url: "http://localhost/jobjobDatabase/update_job.php",
        data: {ProjectName: $("#ProjectName").val()}
        });
    }
    </script>

PHP Code:

<?php


// array for JSON response
$response = array();


// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// check for post data
if (isset($_POST['ProjectName'])) {
    $ProjectName = $_POST['ProjectName']; //Project Name
    echo $ProjectName;




    // mysql inserting a new row
    $result = mysql_query("INSERT INTO postedjobs(ProjectName) 
                       VALUES('$ProjectName')");


    // check if row inserted or not
    if ($result) {
        // successfully inserted into database
        $response["success"] = 1;
        $response["message"] = "games successfully created.";

        // echoing JSON response
        echo json_encode($response);
    } else {
        // failed to insert row
        $response["success"] = 0;
        $response["message"] = "Oops! An error occurred.";

        // echoing JSON response
        echo json_encode($response);
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing";

    // echoing JSON response
    echo json_encode($response);
}
?>

Any ideas on what I am doing wrong or I should try? I have been googleing and reading/trying everything and nothing seems to work. Thanks!