php - jquery选项卡,为每个选项卡重新加载页面

标签 php jquery jquery-ui redirect jquery-tabs

使用 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/

相关文章:

php - 使用 jQuery、AJAX 和 PHP 的这种组合,我如何捕获来自 PHP 的错误?

javascript - $ ('.input:checked' ) 的行为不同于 $ ('.input[checked=checked]' )

javascript - 如何设置整个按钮组的宽度?

javascript - 如何使用jquery从数组中删除选定的值

php - move_uploaded_file() 错误

php - 有关如何生成 Oauth 随机数的安全问题

php - 在 Zend Framework 中缓存 PDOStatement 对象

jquery - $.scrollTo() 函数水平?

jquery - css 图片库有问题..?

php - Laravel 字符串验证以允许空字符串