php - Open specific jquery ui tab based on which the previous page is -


i have created jquery ui tab , when page containing jquery ui tab loads, specific tab open depends on previous page. far, have down following:

php:

  1. obtain previous page using $_server['http_referer'];
  2. determine tab open using "if" statement (assigning tab_index variable);
  3. assign "tab_index" hidden input value.

javascript:

  1. pick hidden input value , assign js variable;
  2. ??

then not sure how make work in $('#tabs').tabs({.... statement. idea of how resolve appreciated. many thanks.

php: $string = $_server['http_referer']; $string = substr($string, -(strlen($string)-strrpos($string, '/')-1), strlen($string)-strrpos($string, '/')); if ($string == "specific_page.php") {     $tab_index = 2; } else {     $tab_index = 0; }  html: ... <input id="hidden_input" type="hidden" value="<?php echo $tab_index; ?>" />  js: $(document).ready(function() { var tab_index = $('#hidden_input').attr('value') $('#tabs').tabs({ cache:false,     ajaxoptions: {         error: function(xhr, status, index, anchor) {             $(anchor.hash).html("couldn't load tab. we'll try fix possible.");         }     },     ...something here tab selection?... }); }); 

you can define active tab using

$(".selector" ).tabs({active: 2 }); 

meaning, code be, if understand tab_index correctly.

$('#tabs').tabs({ cache: false, active: tab_index, ajaxoptions: {     error: function(xhr, status, index, anchor) {         $(anchor.hash).html("couldn't load tab. we'll try fix possible.");     } }, ...something here tab selection?... }); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -