diff --git a/includes/smarty.php b/includes/smarty.php index 5b8fdb4..17ce792 100644 --- a/includes/smarty.php +++ b/includes/smarty.php @@ -150,6 +150,10 @@ function display_ajax_return($data=null, $pretty=false) { global $debug_ajax; if (is_null($data)) $data = array(); + // Adjust HTTP error code on unsuccessfull request + elseif (isset($data['success']) && !$data['success'] && http_response_code() == 200) + http_response_code(400); + if (isset($_SESSION['messages']) && !empty($_SESSION['messages'])) { $data['messages'] = $_SESSION['messages']; unset($_SESSION['messages']);