dimanche 11 octobre 2015

Post resource store via jquery ajax

Is it possible to post data to resource store via ajax, I tried but it didn't work.?

I have this code

   var age = $('#age).val();
                            var name = $('#name).val();

                            $.ajax({
                                  type:'POST',
                                  dataType:'json',
                                  data:{name:name,age:age},
                                  url:'register.store',
                                  success:function(data){

                                      //LOG DATA HERE

                                  }

                               });

In my controller

  public function store(Request $request)
    {
        //

        return $request->all()
    }

It gives me this error

MethodNotAllowedHttpException in RouteCollection.php line 219:



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire