Allow ajaxError to specify an error code as well.

JI-53
pull/38/head
thomasmars 2017-02-24 16:34:16 +01:00
parent ec5a164971
commit 933b95f5ce
1 changed files with 6 additions and 1 deletions

View File

@ -2690,13 +2690,18 @@ class H5PCore {
* @param string $message
* @since 1.6.0
*/
public static function ajaxError($message = NULL) {
public static function ajaxError($message = NULL, $error_code = NULL) {
$response = array(
'success' => FALSE
);
if ($message !== NULL) {
$response['message'] = $message;
}
if ($error_code !== NULL) {
$response['error_code'] = $error_code;
}
self::printJson($response);
}