以编程方式卡死在jQuery Tab中重新加载Ajax内容 [英] Stuck reloading ajax content in a jQuery Tab programatically
问题描述
我对编程很陌生,所以请原谅我的笨拙. 我为我的应用程序使用了出色的jQuery选项卡,我通过ajax将外部内容加载到选项卡中,在这些选项卡之一中,我需要以编程方式重新加载该选项卡的内容,然后生成结果.我没有遵循文档*.
I'm very new to programming so please forgive me my noobness. I'm using the excellent jQuery tabs for my application, I load external content into the tabs via ajax, and in one of those tabs I need to programatically reload the content of that tab fter a result. I've followed the documentation* to no avail.
我非常简单地使用以下方法初始化了根页面中的标签:
I have initialized the tabs in my root page very simply with:
JavaScript:
Javascript:
$(document).ready(function(){
$("#tabs").tabs({ cookie: { expires: 30 } });
});
HTML:
<div id="tabs">
<ul>
<li><a href="#moderatorManage"><span>Find and Manage Moderators</span></a></li>
<li><a href="flaggedCards/" id="flaggedCards" ><span>Flagged Cards</span></a></li>
<li><a href="pendingDelete/"><span>SinBin / Pending Delete</span></a></li>
</ul>
</div>
您可以看到我加载了一个外部标记"flaggedCards/",在那里,我有更多具有此功能的jQuery:
You can see I load an external URL of "flaggedCards/" In there I have more jQuery with this function:
$(document).ready(function(){
$("#controls_{{id}} input").click(function() {
$(this).parent().parent().parent().addClass("highlight").fadeTo("slow", 0.1);
$("#tabs").tabs( 'load' , 0 ); // fails also tried various selectors
});
});
我想做的是在调用该函数时调用flaggedCards选项卡以重新加载.我尝试了各种不同的语法,但无济于事.
What I am trying to do, is call the flaggedCards tab to reload when that function is called, I've tried various different syntaxes to no avail.
- docs.jquery.com/UI/API/1.7.1/Tabs#method-load
推荐答案
我能够复制您在帖子中报告的完全相同的问题.这就是我最终解决它的方式.
I was able to duplicate the exact same issue that you report in your post. This is how I ended up solving it.
在托管标签的根页面中,添加以下功能:
In the root page hosting the tabs, add this function:
function selectTab(index){
$("#tabs").tabs('load', index);
}
然后在您的外部网址页面"flaggedCards/"中,替换以下行:
Then in your external Url page "flaggedCards/", replace the line that says:
$("#tabs").tabs( 'load' , 0 );
与此:
selectTab(0);
我不知道为什么这种解决方法可以解决问题.也许是一个错误.
I don't know why this workaround does the trick. Perhaps it is a bug.
这篇关于以编程方式卡死在jQuery Tab中重新加载Ajax内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!