1
AJAX:不匹配格式HH:MM:SS
$.ajax({
url: '/api/someurl',
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
duration: $('input[name="duration"]').val(),
}, error: function (response) {
var json = $.parseJSON(response.responseText);
for (var key in json) {
console.log(json['key']);
}
}
});
輸入是這樣的:
08:00:00
or
19:00:00
or
20:05:01
這是我的驗證:
$this->validate($request, [
'duration' => 'required|date_format:"HH:mm:ss"',
]);
錯誤:
The duration does not match the format HH:mm:ss.
@DanWhite感謝的情況下 – NaMo