我是一个完整的JavaScript菜鸟。我现在正在使用它:
$(function() {
$("#tabs").tabs({
ajaxOptions: {
error: function(xhr, status, index, anchor) {
$(anchor.hash).html(
"Couldn't load this tab. We'll try to fix this as soon as possible.");
}
}
});
});
有人可以告诉我如何添加此选项:
spinner: 'Loading...'
答案 0 :(得分:1)
您必须使用<span>
<li><a href="#tabs-1"><span>Test 1</span></a></li>
<li><a href="#tabs-2"><span>Test 2</span></a></li>
<li><a href="#tabs-3"><span>Test 3</span></a></li>
<li><a href="Home/About"><span>Test Ajax</span></a></li>
并使用如下脚本:
$("#tabs").tabs({
ajaxOptions: {
error: function(xhr, status, index, anchor) {
$(anchor.hash).html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " +
"If this wouldn't be a demo.");
}
}
});
$("#tabs").tabs("option", "spinner", 'Retrieving data...');
要测试它你应该做一个延迟的ajax调用。我已经调用了一个MVC动作,让线程进入睡眠状态2秒钟。