在选项卡下动态加载页面

编程入门 行业动态 更新时间:2024-10-27 22:21:49
本文介绍了在选项卡下动态加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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.

更多推荐

在选项卡下动态加载页面

本文发布于:2023-10-08 10:04:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472304.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   加载   页面   动态

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!