Inserting a record to mysql using jquery
<p>I want to use a cloned div that contains a form to insert a record to the database using this code</p>

<pre><code>$(document).ready(function() {

    $("#button").click(function() {
        $("&lt;div class='newclone' id='xxx'&gt;&lt;article&gt;&lt;form method='post' id='aj'&gt;&lt;input type='checkbox'&gt;&lt;label&gt;Firstname&lt;/label&gt;&lt;input type='text' value='' name='firstname'&gt;&lt;label&gt;Secondname&lt;/label&gt;&lt;input type='text' value='' name='secondname'&gt;&lt;label&gt;City&lt;/label&gt;&lt;input type='text' value='' name='city'&gt;&lt;input type='hidden' value='4'&gt;&lt;/article&gt;&lt;input type='submit' value='insert' class='one'&gt;&lt;button class='two'&gt;Delete&lt;/button&gt;&lt;button class='three'&gt;Cancel&lt;/button&gt;&lt;/form&gt;&lt;/div&gt;").appendTo('.clone-container');
    }); 

    $('.one').click(function() {
        $.ajax({
            type: "POST",
            url: "insert.php",
            data: $("#aj").serialize(),
            success: function() {
                alert('Inserted!');
            }
        });
    });
});
</code></pre>

<p>This is the php file</p>

<pre><code>$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("clone", $con);

$firstname=$_POST['firstname'];
$secondname=$_POST['secondname'];
$city=$_POST['city'];
mysql_query("INSERT INTO clone(firstname,secondname,city) VALUES ('$firstname','$secondname','$city')");
</code></pre>

<p>edit</p>

<p>the problem is that there seem to be nothing posted</p>
