When using jQuery UI tabs one can specify a .php or .html file as the tab content. Is it possible to force the content inside the ajax tab to refresh when a user goes to another tab and comes back to it again? (开发者_Go百科The tab contains dynamic information, and the user may perform an action in another tab that necessitates a refresh).
You can use the cache option:
$( ".selector" ).tabs({ cache: true });
More info here: http://jqueryui.com/demos/tabs/#option-cache
I think it does that by default. At least this code shows the values for a split second before it reloads from the ajax call. If not, maybe you can do a reload with this event since it is fired every time a page is navigated to:
$('#tabContainer').bind('tabsselect', function (event, ui) {
$(ui.panel).html("tab is " + ui.tab + "<br/>\r\n" + // string
"panel is " + ui.panel + "<br/>\r\n" + // HTMLDivElement
"index is " + ui.index + "<br/>\r\n" +
"Hello, world!");
});
精彩评论