I'm working with a 3rd party API which does not support ajax so I need to submit my form to them the normal html/php way. But before doing this, I need to use ajax to post the form data to another php script which does some processing and sends and email.

For a test I did the following.

form normally submits to test2.php:
<form id="contact" method="POST" action="test2.php">
    <input type="text" id="fname" name="fname"/>
    <input type="submit" id="send" name="send" value="submit"/>
ajax posts to test1.php:
  var fname = $('input#fname').val();
  var dataString = "fname=" + fname;

          type: "POST",
          url: "test1.php",
          data: dataString,
          success: function() {
You can probably see, I don't know how to use preventDefault and then trigger the submit and that may be part of my problem.

Doing it this way, the ajax part works but it never follows through by triggering the submit.

I tried a regular ajax post and it just submits to the action="test2.php" as if it's ignoring my ajax post.

Can someone please show me how to make this test example do what I'm trying to do?

Thank you