<form id="petform" action="/" method="post">
Enter your pets name: <input id="petinput" type="text" name="petname" />
<input id="petnamesubmit" type="submit" value="Submit to Database" />
// PHP MySQL: Post PetName to MySQL Database using AJAX
alert("Data has been submitted to the Database");
you were getting the first error becuase you were trying to serialize the button itself becuase you binded the function to.
i put your code in a document ready section and binded directlky to the forms submit event. give this a shot