mercredi 18 janvier 2017

How to get a cookies via ajax (laravel 5.1)?

I need your help with Laravel cookies! Issue in the next:

I have two routes:

Route::get( 'url-1', function () {
    ...
    $cookie = Cookie::forever('cookie-key', 'cookie-value');
    ...
    return redirect('<external-url>')->withCookie($cookie);
});

Route::get( 'url-2', function () {
    ...
    $cookie_value = Cookie::get('cookie-key');
    ...
    return view ("<view>", [
        'cookie_value' => $cookie_value
    ]);
});

When I go to url-1 it redirects me to external URL. On this external URL I am sending the ajax request to url-2. I am getting an empty value of cookie_value=. Please help me. Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire