jeudi 26 novembre 2015

LARAVEL 5 routing and jquery validation error

I'm getting a routing error with my jquery validation. mostly in my exp. Laravel is not accepting URL with ? in it. I'm not sure if I'm wrong or I'm just doing it wrong.

the URL I'm generating is canvas/users/validate?email=email@email.com

JavaScript

email: {
            required: true,
            email: true,
            remote: {
                    url:  'canvas/users/validate/email',
                    type: "GET"
            }
        },

route.php

Route::get('canvas/users/validate/email?{email}',
                array('uses'=>'Canvas\UserController@validateEmail'));

controller.php

protected function validateEmail($email) {
        $user = User::where('email',$email)->get();
        if ($user->isEmpty()){
            return 'false';
        }else{
            return 'true';
        }
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire