Search code examples
jquerycontrollerlaravelrouteslaravel-3

Passing javascript data with laravel controller


I have a page with 3 jquery ui tabs. Now when I'm redirecting from a specific controller method within laravel I want to redirect back to my page containing the ui tabs and return to the second ui tab instead of the default first one.

$(function() {
    $("#tabs").tabs({ active: 1 });
});

This is the way I set it to the second tab in a static manner, this loads on every page. Now how can I redirect to a route with 1 as my javascript variable?


Solution

  • Perhaps you can use the Session laravel method. Then you can set active: {{ Session::get('tab_index') }}, for example. Only works for blade templates (templateName.blade.php)