Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JQuery UI选项卡,更改选项卡URL(JQuery 1.10+;)_Jquery_Jquery Ui_Jquery Ui Tabs - Fatal编程技术网

JQuery UI选项卡,更改选项卡URL(JQuery 1.10+;)

JQuery UI选项卡,更改选项卡URL(JQuery 1.10+;),jquery,jquery-ui,jquery-ui-tabs,Jquery,Jquery Ui,Jquery Ui Tabs,有没有办法通过jquery/javascript修改jquery ui中选项卡的链接 示例问题类似于 选项卡具有URL“http://thanksforyourhelp/greatly/appreciated/“ 如果在该选项卡上提交表单,数据将写入数据库。响应提供添加到数据库的行的ID 下一次访问该特定选项卡时,该链接实际上应该是 'http://thanksforyourhelp/greatly/appreciated/ID' 由于表单的响应(这里也是ajax)将其发送回,因此现在知道了

有没有办法通过jquery/javascript修改jquery ui中选项卡的链接

示例问题类似于

选项卡具有URL
“http://thanksforyourhelp/greatly/appreciated/“

如果在该选项卡上提交表单,数据将写入数据库。响应提供添加到数据库的行的ID

下一次访问该特定选项卡时,该链接实际上应该是

'http://thanksforyourhelp/greatly/appreciated/ID' 
由于表单的响应(这里也是ajax)将其发送回,因此现在知道了该ID。当这个响应出现时,我必须重新加载当前选项卡,其中包含ID的URL

在jQuery1.10之前。我们可以这样做

$("#tabs").tabs("url", index, url);

我们如何在jQueryUI1.10+中做到这一点。由于JQuery 1.10中删除了URL方法,请在完整的表单提交中执行类似操作。这将更改当前活动选项卡的URL并重新加载该选项卡

var tabs = $("#tabs");
var currentTabIndex = tabs.tabs("option", "active");
var tab = $(tabs.data('uiTabs').tabs[currentTabIndex]);
tab.find('.ui-tabs-anchor').attr('href', "http://thanksforyourhelp/greatly/appreciated/ID");
// If cached initially. Remove cache then
tab.data( "loaded", false);
tabs.tabs("load", currentTabIndex);

在完整的提交表单中执行类似操作。这将更改当前活动选项卡的URL并重新加载该选项卡

var tabs = $("#tabs");
var currentTabIndex = tabs.tabs("option", "active");
var tab = $(tabs.data('uiTabs').tabs[currentTabIndex]);
tab.find('.ui-tabs-anchor').attr('href', "http://thanksforyourhelp/greatly/appreciated/ID");
// If cached initially. Remove cache then
tab.data( "loaded", false);
tabs.tabs("load", currentTabIndex);

选项卡定义为我触发了错误;不得不这样重写:

var tab = $(tabs.data()['ui-tabs'].tabs[currentTabIndex]);

选项卡定义为我触发了错误;不得不这样重写:

var tab = $(tabs.data()['ui-tabs'].tabs[currentTabIndex]);

这比1.10之前的url方法直观得多。谢谢分享。这比1.10之前的url方法直观得多。谢谢分享。