vendredi 2 octobre 2015

Laravel: Ajax post request routing

I am very new to laravel and laravel-5. When I do POST Request, I am getting 200 response with login request in firebug console.

Routes.php

Route::group
(
    [
        'prefix'    => '/',
        'namespace' => 'Landing'
    ],
    function()
    {
        Route::controller('',   'WelcomeController');
    }
);

WelcomeController.php

  public function postUserContact()
   { 
      print_r($_POST);
   }

Ajax request:

$.ajax({
  url           :   window.location.protocol + "//" + window.location.host + '/user-contact',
  type      :   'POST',
  async     :   true,
  cache     :   false,
  processData   :   true,
  data      :   {name:name,email:email,message:message},
  success       :   function (returnedData)
  {console.log(returnedData)}
});

Please correct me if anything wrong



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire