1

I must be missing something, didn't think this would have been a issue.

I have a login form that has no connection to laravel form, although its on the same domain, and a POST route with laravel at "login".

I can change it to GET and everything works, but I would like to use POST.

/online/index.html

$("#login").click(function(e){
    console.log( $("#loginForm").serialize() );
    var request = $.ajax({
      url: "../login/",
      type: "POST",
      data: { test : "someuser" },
      dataType: "json"
    });

    request.done(function( data ) {
      console.log("Complete");
      console.log(data);
    });

    request.fail(function( jqXHR, textStatus ) {
      console.log("Failed");
      console.log(textStatus);
    });
});

Route::post('login', array('as' => 'login', 'uses' => 'AuthController@doLogin'));
( which is below /online/ )

class AuthController extends Controller {

    public function doLogin(){

        $username = Input::get('username');
        $password = Input::get('password');

        return Response::json(Input::all());

    }
}

In the javascript console, when you press login, it shows...

Complete
[]

When it should say something like this...

Complete
[ test => "someuser" ]


Using Laravel 4, jQuery 1.8.3. Any ideas would be great... Thanks!

1 Answers1

1

I just removed the trailing slash in the Ajax request URL and everything worked as planned.