I know there is a few questions like this on here. but I have done a lot of researching and bug fixing all day to try work out why my ajax does not return a response from the php file. All I want is for it to tell me a user has been registered so I can let the user move on with the signing up process. And I just need someones wise guidance to tell me what I am doing wrong!!
so I wont bore you with the validation part of the js file just the ajax
  if(ValidationComplete == true){
   var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.find('[name]').each(function(register, value) {
    var that = $(this),
        name = that.attr('name'),
        value = that.val();
        data[name] = value; 
});
    $.ajax({
    url:url, 
    type:type,
    data: data,
    dataType: 'json', 
    success: function(result){
        alert(result.status);
        console.log(result.data);
    },
error: function(xhr, textStatus, error){
  console.log(xhr.statusText);
  console.log(textStatus);
  console.log(error);
   }        
});
return false;
} else {
    return false;
}
currently with this, if I remove the dataType bit the alert bit happens but currently with it there nothing does.
again I will just skip to the chase on the php file
    $query = "INSERT INTO person 
   VALUES('','$first_Name','$surname','$email','$dob','$password',
  '1','','0','1','','','','$emailCode')";
  if($query_run =mysql_query($query)) {
      echo json_encode(array("response"='true'));
Any help would be amazing!!!!!
updated code:
  <?php    
if( isset($_POST['firstname']) && 
isset($_POST['surname']) && 
isset($_POST['email']) && 
isset($_POST['day']) && 
isset($_POST['month']) && 
isset($_POST['year']) && 
isset($_POST['password']) && 
isset($_POST['re_type_password'])){
  $first_Name = $_POST['firstname'];
  $surname = $_POST['surname'];
  $email = $_POST['email'];
$password = $_POST['password'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$re_type_password = $_POST['re_type_password'];
$emailCode = md5($_POST['$first_Name'] + microtime());
if(!empty($first_Name)&& 
!empty($surname)&& 
!empty($email)&& 
!empty($day) && 
!empty($month) && 
!empty($year) && 
!empty($password)&&                                   
!empty($re_type_password)){
  if(strlen($firstname)>30 || strlen($surname)>30 || strlen($email)>50){
  echo 'the data enetered is to long';
} else {
  if($password != $re_type_password){
  echo 'passwords do not match, please try again.';
} else{ 
$query = "SELECT email FROM person WHERE email ='$email'";
$query_run = mysql_query($query);
if(mysql_num_rows($query_run)==1){
  echo 'Email address already on databse';         
} else{
  if($day>31 || $month>12){
    echo 'date of birth wrong';
  } else{
    $dob= $year.'-'.$day.'-'.$month;
  $query = "INSERT INTO person 
  VALUES('','$first_Name','$surname','$email','$dob','$password'
   ,'1','','0','1','','','','$emailCode')";
   if($query_run =mysql_query($query)) {
      email($email, 'Email Confirmation', "hello ". $first_Name." ,
    \n\n you need to   activate your account so click the link  ");
    $return_data['status'] = 'success';
     echo json_encode($return_data);
  } else {
      echo @mysql_error();
  }
}
 }
  } 
  }
  } else {
      echo "<p id='error'> All fields are required. Please try again.</p>";
  }
      }
   ?>
  <?php
  } else if (loggedIn()) {
echo 'you are already registed and logged in';
   }
  ?>
   </body>
  </html>
 
     
    