jQuery UI选项卡-获取使用Ajax加载的选项卡的URL [英] jQuery UI tabs - getting URL of tab loaded with Ajax
问题描述
我有使用AJAX的jQuery UI选项卡.我的问题是我似乎无法检索在选项卡中加载的网址.
I have jQuery UI tabs using AJAX. My problem is I can't seem to retrieve the url which was loaded inside a tab.
例如-我得到这样的已加载选项卡的URL
For example - I get URL of loaded tab like this
var links = $("#tabs > ul").find("li a");
var selectedTab = $("#tabs").tabs('option', 'selected');
var url = $.data(links[selectedTab], 'load.tabs');
其中url是当前打开的标签页的网址.
Where url is the url of currently opened tab.
在标签中,我有一个AJAX调用,它调用相同的url,但带有一些参数,即
In the tab I have an AJAX call, which calls the same url but with some parameters, i.e.
$.ajax({
method: 'GET',
url = url+'?parameter=value'
});
执行此调用后,将调用一个新创建的URL,重新加载tab,但是用于检索已加载的tab URL的变量保持不变,这意味着我的参数丢失了.
Once this call is executed, a newly created URL is called, tab is reloaded, but the variable which retrieves the loaded tab url remains the same, which means my parameters are missing.
想法?
推荐答案
$("#tabs").tabs({
load: function(event, ui){
var anchor = ui.tab.find(".ui-tabs-anchor");
var url = anchor.attr('href');
}
});
这会将当前标签页URL保存在变量 url
This will save the current tab URL in variable url
这篇关于jQuery UI选项卡-获取使用Ajax加载的选项卡的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!