lundi 2 janvier 2017

how to pass data to controller as parameter with ajax?

I want to pass Array to Controller but I can't give correct URL when Click submit 404 error

my route

Route::post('data/{data}','DataController@store');

function

    public function store(Request $request)
{
        dd($request);

    return response()->json([
        'success' => true,

    ]);

}

Ajax

     $.ajax({
            method:'POST',
            url:"/store/"+arr,
            headers: {
                'X-CSRF-TOKEN': CSRF_TOKEN
            },
            data:{
                inputName: name
            },
            success:function(response){
            alert('successful')                }
        });

and error

    POST http://localhost:8000/store%7Bname,number,number,address,work,$2y$10$Nl28n1pWCEaHxiHlcG.Y1On2DOdtXluHP0OvN5ih.Bvdfp/Issco2%7D 404 (Not Found)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire