jQuery UI并将数据加载到选项卡中

编程入门 行业动态 更新时间:2024-10-28 16:20:40
本文介绍了jQuery UI并将数据加载到选项卡中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用JQuery UI创建一个选项卡,并且我想将我的php文件的内容输入到该选项卡中.我首先创建一个选项卡,然后选择它.

I'm using JQuery UI to create a tab, and I want to the contents of my php file to be entered into this tab. I start by creating a tab, and then selecting it.

function createTab2() { //create a tab $("#tabs").tabs("add","#tabs-2","Second Tab"); $("#tabs-2").css("display","block"); $('#tabs').tabs('select', "#tabs-2"); $.get('tab2.php', function(data) { $('.result').html(data); alert('Load was performed.'); }); }

我尝试使用JQuery .get函数返回数据,并且在出现警报时它可以正常工作.但是,内容没有输入到选项卡中-我只是在Javascript控制台中看到了它们.

I tried using the JQuery .get function to return the data and it works fine as an alert appears. However, the contents are not entered into the tab - I just see them listed in my Javascript console.

如何使php文件的内容显示在此标签中?

How can I make the contents of the php file appear in this tab?

推荐答案

在标签2的标记中,您需要在源html中添加href.

In your markup for tab 2 you need add an href to the source html.

<div id="tabs"> <ul> <li><a ><span>Content 1</span></a></li> <li><a href="tab2.php"><span id="tabs-2">Content 2</span></a></li> <li><a ><span>Content 3</span></a></li> </ul> </div>

或者您可以尝试直接加载标签.

or you can try load the tab directly.

$("#tabs-2").load('tab2.php');

更多推荐

jQuery UI并将数据加载到选项卡中

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

发布评论

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

>www.elefans.com

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