问题
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'
}
});
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?
回答1:
A working approach is:
$(".selector").tabs({
beforeLoad: function (event, ui) {
if ( ui.tab.data( "loaded" ) ) {
event.preventDefault();
return;
}
ui.jqXHR.success(function() {
ui.tab.data( "loaded", true );
});
}
});
Source: https://github.com/jquery/jqueryui.com/blob/master/page/upgrade-guide/1.9.md#deprecated-ajaxoptions-and-cache-options-added-beforeload-event
来源:https://stackoverflow.com/questions/16856795/how-to-change-cache-and-ajaxoptions-when-upgrading-to-jquery-ui-1-10