将数组从jQuery(ajax)发送到PHP

class email is an array of email addresses. How do i get the array in jQuery and then send the data with AJAX to send.php along with class title and message?

    <input type='text' size='30' class='email' value='testing1@gmail.com' />
    <input type='text' size='30' class='email' value='testing2@gmail.com' />
    <input type='text' size='30' class='email' value='testing3@gmail.com' />
    <input type='text' size='30' class='title' value='testing title' />
    <input type='text' size='30' class='message' value='testing message' />

<script type="text/javascript">
$(function() {
var title = $('.title').val();
var message = $('.message').val();

var dataString = 'title=' + title + '&message=' + message;
$.ajax({
    type: "POST",
    url: "send.php",
    data: dataString,
success:function () {


}

});
});
</script>

send.php

<?php


  $email = $_POST['email'];
  $title = $_POST['title'];
  $message = $_POST['message'];

foreach($email as $value) {

//send email

}
?>

You can do it more simply that Felix King's answer, using serialize(), if you name your inputs:

<form id="the-form">
    <input type='email' size='30' name="email[]" value='testing1@gmail.com' />
    <input type='email' size='30' name="email[]" value='testing2@gmail.com' />
    <input type='email' size='30' name="email[]" value='testing3@gmail.com' />
    <input type='text' size='30' name='title' value='testing title' />
    <input type='text' size='30' name='message' value='testing message' />
</form>
$.ajax({
    type: "POST",
    url: "send.php",
    data: $("#the-form").serialize(),
    success: function() {

    }
});

This should do it:

var data = {
    title: $('.title').val(),
    message: $('.message').val(),
    email: $('.email').map(function(){ return $(this).val(); }).get()
};

$.ajax({
    type: "POST",
    url: "send.php",
    data: data,
    success:function () {

    }
});

data.email will contain an array of email addresses. jQuery takes care to encode the data properly. See jQuery.param.

Won't this work?:

var datastring = $('#yourform').serialize();