Old version of the AJAX response template (http://blog.the-inspired-ones.de/ajax-uniform)
<?php | |
header::contentType('application/json'); | |
$errors = ''; | |
// check each parameter of the request if it is erroneous | |
foreach (array_keys(get()) as $field) { | |
$errors .= $form->hasError($field) ? "\"$field\"," : ''; | |
} | |
// strip trailing comma | |
$errors = substr($errors, 0, -1); | |
?> | |
{ | |
"success": <?php e($form->successful(), 'true', 'false')?>, | |
"message": "<?php echo trim($form->message()) ?>", | |
"errors": [<?php echo $errors ?>] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment