You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
627 B
PHP
27 lines
627 B
PHP
<?php
|
|
|
|
// Special treatment for AJAX submissions
|
|
if(r::is('POST')) {
|
|
$fields = [];
|
|
foreach(r::data() as $field => $value) {
|
|
$fields[$field] = ($form->error($field) != []);
|
|
}
|
|
|
|
// Use error or success message depending on status
|
|
if($form->success()) {
|
|
$message = l::get('contact.message.success', 'Thank you for your message, I will get back to you soon.');
|
|
} else {
|
|
$message = snippet('templates/contact.errors', compact('form'), true);
|
|
}
|
|
|
|
$data = [
|
|
'success' => $form->success(),
|
|
'fields' => $fields,
|
|
'message' => $message
|
|
];
|
|
|
|
echo response::json($data);
|
|
} else {
|
|
require_once('default.json.php');
|
|
}
|