【发布时间】:2012-09-12 10:15:15
【问题描述】:
我正在尝试处理 Ajax 中的错误。为此,我只是想在 Symfony 中重现这个 SO question。
$.ajaxSetup({
error: function(xhr){
alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
}
});
但我无法弄清楚控制器中的代码在 Symfony2 中会是什么样子来触发header('HTTP/1.0 419 Custom Error');。是否可以附上个人消息,例如You are not allowed to delete this post。我是否也需要发送 JSON 响应?
如果有人对此熟悉,我将非常感谢您的帮助。
非常感谢
【问题讨论】:
标签: symfony symfony-2.1