Skip to content

Instantly share code, notes, and snippets.



Last active Sep 11, 2015
What would you like to do?
Old version of the AJAX response template (
$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