在选项卡下动态加载页面 [英] load page under tab dynamically

查看:208
本文介绍了在选项卡下动态加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery插件使用"标签(通过ajax内容)."

I am using " tabs(content via ajax) using jQuery plugin."

当我单击选项卡时,将根据给定的URL将选定页面加载到其内容内.

When I click on the tab, according to the URL given selected page loads inside its content.

我想要的是:
我想在同一标签下显示另一个页面,然后删除当前页面的内容.

What I want is:
I want to display another page under that same tab and remove the content of current page.

简而言之,如何在不刷新或重定向包含标签结构的主页的情况下,从标签下的已加载内容页面重定向到另一个页面?

In short, how can I redirect from loaded content page under tab to another page without refreshing or redirecting the main page which holds the tab structure?

推荐答案

让我们说这是您的div:

Let's say this is your div:

<div id="content"> </div>

发送ajax

在将获得ajax请求的页面中,您可以

In the page that will get your ajax request you can do

if(isset($_POST['getContent')){
    $_POST['getContent'] = file_get_contents('getContent.php');    
    echo $_POST['getContent'];
}
$.ajax({
    type:'POST',
    URL : 'page that will give you your reposne',
    data : {
        getContent : 'getContent'
    },
    success:function(data){
        if(data){
            $('#content').html(data);
        }
    }
});

file_get_contents('getContent.php')以字符串形式返回文件的内容,因此,如果它是有效文件,则应该没有问题.

The file_get_contents('getContent.php') returns the content of the file in a string, so if it is a valid file you should have no problems.

这篇关于在选项卡下动态加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆