jQuery AJAX POST示例

I am trying to post my data and put it into a database, but I can't seem to get it to work... any suggestion would be great!

Thanks!

html file (form) http://pastie.org/private/dkdzrrdvet7jq3muxir8g

js file - http://pastie.org/private/v8knmt6c82t01lqgsopqa

php file - http://pastie.org/private/3ydgbvwbretcku9ivsqhg

Are you sure your php code will recognize the data you pass through the javascript ajax's request? You are doing a POST request, not a GET.. i don't know if query string parameters will be added to $_POST

I'd use JSON data..

var requestData = {
    first: first, 
    second: second, 
    //...
}
var dataToSend = JSON.stringify(requestData);

however, could you be more accurate on the error/errors you get?

you have defined variables "1st", and "2nd" which are not valid JavaScript variable names. so your script fails to parse and execute.

by the way, use

var dataString = $("form").eq(0).serialize();

to get form field values.