1

This is my routes.php

Route::controller('user','UserController');

My javascript code which is in my blade file

  jQuery.ajax({
            type:"POST",
            url:"/user/login-from-fb/",
            data:{
                data:data,
                _token: "<?php echo csrf_token(); ?>"
            },
            success:function(data){

            }
        });

In my UserController.php

public function postLoginFromFb(){
    $data = \Input::all();
    var_dump($data);
    die;
}

This is my code but looks like i am always getting an error. This is the error:

Sorry, the page you are looking for could not be found.

NotFoundHttpException in Controller.php line 259: Controller method not found.

Any ideas why this is happening?

Your help will be greatly appreciated!

Thanks! :)

4
  • your url is diferent from the route controller Commented May 11, 2015 at 9:52
  • @madalinivascu i think not, I think what Route::controller('user','UserController'); means is that when you have /user in the url, you are referring that to all functions/method in your UserController file Commented May 11, 2015 at 9:55
  • did you send csrf token? Commented May 11, 2015 at 9:56
  • 1
    @user3621494 if you looked at my code, you'll see that I sent it. Commented May 11, 2015 at 9:57

1 Answer 1

2

try using this types url

<?php echo URL::to('user/login-from-fb') ?>
Sign up to request clarification or add additional context in comments.

2 Comments

and one more thing, Input::all() is not used in Laravel 5. You should use Request::all() in order to retrieve request parameters @PinoyStackOverflower
This made my work so I'm up voting it. But, does any one have a explanation why it works?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.