Form not being serialized? jquery and ajax
<p>I have a form that is submitted to a php script with jquery and ajax, but turning out blank in the php script.</p>

<p>form:</p>

<pre><code>&lt;table id="coachapplication"&gt;

&lt;form id="coachapplicationform" action="" method="post"&gt;

&lt;tr&gt;&lt;td&gt;Briefly explain your teaching methods:&lt;br /&gt; &lt;textarea maxlength="100" name="coachmethods" id="coachmethods"&gt;&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt;&lt;td&gt;&lt;input type="checkbox" value="yes" name="agree" id="agree" /&gt; I am fully prepared to take on the responsibilities of being a coach which include logging into the website daily and hosting sessions.

&lt;tr&gt;&lt;td&gt;&lt;button id="submitcoachapplication" type="button"&gt;Submit&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;/form&gt;

&lt;/table&gt;
</code></pre>

<p>jquery script:</p>

<pre><code>$('#submitcoachapplication').click(function() {

$.ajax({

type: "POST",

url: "includes/sendcoachapplication.php",

data: $("form#coachapplicationform").serialize(),

success: function(msg){

    $("#coachapplication").html(msg);

}

});

});
</code></pre>

<p>php script:</p>

<pre><code>&lt;?php

session_start();

$user = $_SESSION['username'];

include("dbcon.php");

include("user.php");

$result = mysql_query("SELECT * FROM coachapplications ORDER BY username");

while($row = mysql_fetch_array($result)) {

$username = $row['username'];

if($username == $user) die("You already have a pending application.");

}

$coachmethods = $_POST['coachmethods'];

$coachmethods = mysql_real_escape_string($coachmethods);

$agree = $_POST['agree'];

if($coachmethods == "") die("Please enter some info about how you intend to teach.");

if($agree != "yes") die(" Please agree to the terms.");

$sql="INSERT INTO coachapplications (username, methods) VALUES ('$user', '$coachmethods')";

if (!mysql_query($sql,$con)) die('Error: ' . mysql_error());

echo 'Your application has been submitted, and is awaiting admin approval. If you are found suitable for the program, you will be taught how to use the system.';

mysql_close($con);

?&gt;
</code></pre>
