Load jQuery tabs from Ajax -


i have loading image works using code below. shows animated gif , waits html fetched url. once fetched hides loading div , loads html bite div. html returned contained within jquery tabs when html displayed tabs not rendered , li elements shown.

is possible fetch html contains jquery tabs via ajax , render these tabs? if doing wrong?

<div id="loader" style="text-align:center; display:none;"> <img src="img/ajax-loader.gif" alt="loading" /> </div>  <div id="bite"></div>  $(document).ready(function () {   $('#loader').show();   $.ajax({     url:'http://www.domain.com/bitesized/main.php?uid=<?php echo $uid; ?>',     complete: function(data){         $('#loader').hide();         $('#bite').html(data.responsetext);         // these divs ids available after load above , meant render tabs         $("#tabs").tabs();         $("#fragment-a").tabs();     }   }); }); 

i created code, can load ajax spinner. note set , use option "ajax_href", come html rel attribute. can set option directly each link. use "width" , "height" resize each tab-content. looks nice, when having different content or files tabs.

$(document).ready(function() {  // check $('.jquery_tabs_ajax').each(function() {       // tabs     var $tabs = $(this).tabs({           cache: false,         ajaxoptions: { async: true, cache: false },         show: function(event, ui) {              //             var my_panel_id = '#ui-tab-' + (ui.index + 1);             var get_panel_id = $(my_panel_id);             var get_parent_link = get_panel_id.parents('ul:eq(0) li a[href="' + my_panel_id + '"]');             var get_parent_rel = get_parent_link.attr('rel');              // check options             if(get_parent_rel) {                  // option object                 var $obj_option = {};                  // split                 $split_option_a = get_parent_rel.split(';');                 for(var = 0; < $split_option_a.length; so++) {                     $split_option_b = $split_option_a[so].split('=');                     $obj_option[$split_option_b[0]] = $split_option_b[1];                 }                  // load ajax                 if($obj_option.ajax_href) {                      // set spinner                     get_panel_id.html('<div class="spinner_container"><div class="spinner"></div></div>')                      // load ajax                     $.ajax({                          type: "post",                         url: $obj_option.ajax_href,                         async: true,                         cache: false,                         success: function(response_text) {                              // set html                             get_panel_id.html(response_text);                         }                     });                 }                  // check resize                 if($.colorbox && ($obj_option.width || $obj_option.height)) {                      // resize                     $.colorbox.resize($obj_option);                 }             }         }     }); }); 

});


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -