Error messages for ajax

BUT: php curl always returns 400 (instead of e.g. 404)