ajax发布到php文件

I'm not able to get this to work - this is my first attempt at this. I do realize that the information has not been serialized, I just wanted to get this to work first.

Any ideas what I'm doing wrong here? It's not saving the information to the mysql database.

index.html :

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="purchase.js"></script>
</head>

<form name="paypal_form" onsubmit="return validate_form();" method="post">
<input type="text" size="25" name="os0" value="">
<input type="text" size="25" name="os1" value="">
<input type="hidden" name="item_name" value="product">
<input type="image" src="images/paypal.gif" name="submit">
</form>

payment.js :

function validate_form()
{

// code to validate form data 
//  ....


    valid = true;

    var regcode = document.paypal_form.os0.value;
    var email = document.paypal_form.os1.value;
    var product = document.paypal_form.item_name.value;

    var dataString = 'regcode=' + regcode + '&email=' + email + '&product=' + product;

    $.ajax({
        url: "/process.php",
        type: "POST",
        data: dataString,
        success: function()
        {
            alert("Order Submitted");
        }
    });

    return valid;
}

process.php :

$dbhost = "localhost";
$dbuser = "dbuser";
$dbpass = "dbpass";
$dbname = "dbname";

$date = date('Y/m/d');

$RegCode = $_POST['regcode'];
$Email = $_POST['email'];
$Product = $_POST['product'];

mysql_connect($dbhost, $dbuser, $dbpass);

// Store the transaction ID in the database
mysql_query("INSERT into payment (date, regcode, sentemail, status) values ('$date', '$RegCode', '$Email', '$Product')");

if process.php is in the same folder make it url:'process.php' and also

mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db("dbname", $con);

Add below attribute in form tag and try

action="javascript:void(0);"