【发布时间】:2016-01-25 04:47:05
【问题描述】:
在 Laravel 5.1 项目中
我收到这个 Ajax 响应错误
{"errors":["The Address Name field is required.","The Recipient field is required.","The Address field is required."]}
如果不是验证中的 Ajax 响应,我们使用 has 方法来确定哪个字段有错误。
如您所见,存在 3 个字段有错误。我正在使用 twitter-bootstrap,我想在图像中显示这些错误
如何获取字段名称?我需要一个类似于普通请求的 has 方法。
【问题讨论】:
-
为什么不先使用 clent 端验证,然后再使用 PHP 端验证
-
在发送 ajax 之前同意上述验证。发送请求的唯一方式是验证完成时
标签: php jquery ajax twitter-bootstrap laravel