开发者

jQuery UI tabs - getting URL of tab loaded with Ajax

开发者 https://www.devze.com 2023-04-07 07:08 出处:网络
I have jQuery UI tabs using AJAX. My problem is I can\'t seem to retrieve the url which was loaded inside a tab.

I have jQuery UI tabs using AJAX. My problem is I can't seem to retrieve the url which was loaded inside a tab.

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');

Where url is the url of currently开发者_高级运维 opened tab.

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'
});

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.

Ideas?


$("#tabs").tabs({  
    load:  function(event, ui){  
        var anchor = ui.tab.find(".ui-tabs-anchor");  
        var url = anchor.attr('href');  
    }  
}); 

This will save the current tab URL in variable url


you can keep a global variable for the URL.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号