Laravel Js Ajax注册用户,错误提示显示

HTML

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="csrf-token" content="{{ csrf_token() }}"/>
    <title>Document</title>
</head>
<body>
name :<input type="text" name="" id="name"><br>

email :<input type="email" name="" id="email"><br>
password :<input type="text" name="" id="password"><br>

<button type="submit" id="submit">submit</button>

<div id="div4" style="height: 50px"></div>



</p>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script !src="">
    $(function () {
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $('#submit').click(function () {
            $('#div4').html('');
            $.ajax({
                url: '{{route('users.store')}}',
                type: 'post',
                data: {"name": $('#name').val(),"email": $('#email').val(), "password": $('#password').val(),},
                timeout: 430000,
                success: function (data) {

                    $('#div4').html(data.name);
                },
                error: function (message) {
                    var a ='';
                    $.each(message.responseJSON.errors,function (index,item) {
                         a+=
                             item+'<p>'
                    });
                    //错误提示
                     $('#div4').html(a);
                    
                }
            });
        });
    })
</script>
</body>
</html>

controller

    public function store(UserRequest $request,User $user)
    {
        $data =[
            'name'=>$request->name,
            'email'=>$request->email,
            'password'=>$request->password,
        ];
        return $user->create($data);
    }