使用 jQuery ui 选项卡,有没有一种有效的方法来重新加载每个选项卡的页面?
我尝试过这样做
$('#tab_two').click(function() {
window.location = 'http://localhost/page#tab_two';
});
但是,它仍然出现在当前页面上。但是,如果您在此之后刷新页面,它将重定向到#tab_two。
有效重定向页面的唯一方法似乎是使用 PHP。但有
$('#tab_two').click(function() {
header('location: http://localhost/page#tab_two');
});
弄乱了页面。
关于如何实现这一目标有什么想法吗?谢谢。
最佳答案
我认为您可以使用 load
方法,就像我下面所做的那样:
$(function() {
$( "#tabs" ).tabs();
$( "#tab_two" ).click(function() {
$( "#tabs" ).tabs( "load" , 1 ); // zero-based (tab#1 = 0 index)
});
});
文档:
.tabs( "load" , index ) Reload the content of an Ajax tab programmatically. This method always loads the tab content from the remote location, even if cache is set to true. The second argument is the zero-based index of the tab to be reloaded.
关于php - jquery选项卡,为每个选项卡重新加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12754481/