query($insertquery);

// $datax[‘success’] = true;
// $datax[‘message’] = ‘It Did Work’;

if ($result01) {

$datax[‘success’] = true;
$datax[‘message’] = ‘Successfull!’;
} else {

$datax[‘success’] = false;
$datax[‘errors’] = $errors;
}

// return a response ===========================================================

// if there are any errors in our errors array, return a success boolean of false
// if ( ! empty($errors)) {

// if there are items in our errors array, return those errors
// $data[‘success’] = false;
// $data[‘errors’] = $errors;
// } else {

// if there are no errors process our form, then return a message

// DO ALL YOUR FORM PROCESSING HERE
// THIS CAN BE WHATEVER YOU WANT TO DO (LOGIN, SAVE, UPDATE, WHATEVER)

// show a message of success and provide a true success variable
// $data[‘success’] = true;
// $data[‘message’] = ‘Success!’;
// }

// return all our data to an AJAX call

echo json_encode($datax);
exit;
?>