Skip to content Skip to sidebar Skip to footer

Routing In Laravel, Resolving Url In Ajax

So I'm trying to understand routing in laravel, without much success I'm afraid. My current issue is that I am trying to route so that my login function, which is checked using aja

Solution 1:

Change the url in your ajax to:

url:"/login"

Solution 2:

Try this in your route.

Route::any('login', ['uses' => 'LoginController@doLogin', 'as' => 'login']);

Solution 3:

Let Laravel do it for you.

Name your route...

Route::post('login', array('uses' => 'LoginController@doLogin', 'as' => 'ajax.doLogin'));

Link to your route by the name in Javascript...

url:"{{ URL::route('ajax.doLogin') }}",

Post a Comment for "Routing In Laravel, Resolving Url In Ajax"