升级到jQuery UI 1.10时如何更改"cache"和"ajaxOptions"? [英] How to change `cache` and `ajaxOptions` when upgrading to jQuery UI 1.10?
本文介绍了升级到jQuery UI 1.10时如何更改"cache"和"ajaxOptions"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
自从我升级到jQuery UI 1.10以来,发生了一些变化.在升级之前,与我的 jQuery UI Tab 相关的代码如下:
Since I upgraded to jQuery UI 1.10 something has changed. Before that upgrade, code related to my jQuery UI Tab was the following:
$('.selector').tabs({
cache: true,
ajaxOptions: {
dataType: 'html'
}
});
如 jQuery中所述UI 1.10升级指南,cache
和ajaxOptions
均已删除.该指南还指出要使用beforeLoad
事件,但是如何也可以升级代码?
As wrote in the jQuery UI 1.10 Upgrade Guide, both cache
and ajaxOptions
has been removed. The guide also states to use the beforeLoad
event, but how can I upgrade the code as well?
推荐答案
一种可行的方法是:
$(".selector").tabs({
beforeLoad: function (event, ui) {
if ( ui.tab.data( "loaded" ) ) {
event.preventDefault();
return;
}
ui.jqXHR.success(function() {
ui.tab.data( "loaded", true );
});
}
});
来源: 查看全文