[英]How to display a loading message until the tab content is fully AJAX loaded?
I am using jQuery UI 1.10 and the jQuery UI Tab widget with AJAX functionalities. 我正在使用具有AJAX功能的jQuery UI 1.10和jQuery UI Tab小部件。 The JavaScript code that I am using is stated as-like the following (basic simple): 我正在使用的JavaScript代码如下所示(基本简单):
$('.selector').tabs({
beforeLoad: function (event, ui) {
ui.panel.html('Loading...');
}
});
When a tab "header" is clicked then I would like to display a loading message (a text message) in the tab "body" until the tab content is fully AJAX loaded, after which the loading message should be replaced with the AJAX retrieved data. 单击选项卡的“页眉”时,我想在选项卡的“正文”中显示加载消息 (文本消息),直到选项卡的内容完全AJAX加载为止,然后应将加载消息替换为AJAX检索到的数据。 How can I make that? 我该怎么做?
Isn't it working? 不行吗
$('.selector').tabs({
beforeLoad: function (event, ui) {
//show msg
},
load: function (event, ui) {
//hide msg
}
});
You can do this by: 您可以通过以下方式做到这一点:
show
and create
you call some function that 'll manage which AJAX function to call to load the right content. 在show
和create
的选项卡回调中,您调用一些函数,该函数将管理调用哪个AJAX函数以加载正确的内容。 it's quite long but it gives you more control on what you want to do. 它很长,但是它可以让您更好地控制自己想做什么。
Best Thing I did was just this for ajax driven tabs...Hope you will love this answer 我做的最好的事情就是使用ajax驱动的标签...希望你会喜欢这个答案
$("#facilityTabContainer").tabs({ panelTemplate:"Loading..." , selected : 0, scrollable : true, cache : false }); $(“#facilityTabContainer”)。tabs({ panelTemplate:“ Loading ...” ,selected:0,scrollable:true,cache:false));
and you can even modify the panelTemplate in jquery.ui.tabs also so that all the tabs in you application will automatically get the 'loading text or image'. 您甚至还可以在jquery.ui.tabs中修改panelTemplate,以便应用程序中的所有选项卡都将自动获取“正在加载文本或图像”。 and guess what it also solves your first tab loading problem too.. 并猜测它还能解决您的第一个标签加载问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.