Project

General

Profile

1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
	<meta charset="utf-8">
5
	<title>jQuery UI Tabs - Content via Ajax</title>
6
	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7
	<script src="../../jquery-1.4.3.js"></script>
8
	<script src="../../ui/jquery.ui.core.js"></script>
9
	<script src="../../ui/jquery.ui.widget.js"></script>
10
	<script src="../../ui/jquery.ui.tabs.js"></script>
11
	<link rel="stylesheet" href="../demos.css">
12
	<script>
13
	$(function() {
14
		$( "#tabs" ).tabs({
15
			ajaxOptions: {
16
				error: function( xhr, status, index, anchor ) {
17
					$( anchor.hash ).html(
18
						"Couldn't load this tab. We'll try to fix this as soon as possible. " +
19
						"If this wouldn't be a demo." );
20
				}
21
			}
22
		});
23
	});
24
	</script>
25
</head>
26
<body>
27

    
28
<div class="demo">
29

    
30
<div id="tabs">
31
	<ul>
32
		<li><a href="#tabs-1">Preloaded</a></li>
33
		<li><a href="ajax/content1.html">Tab 1</a></li>
34
		<li><a href="ajax/content2.html">Tab 2</a></li>
35
		<li><a href="ajax/content3-slow.php">Tab 3 (slow)</a></li>
36
		<li><a href="ajax/content4-broken.php">Tab 4 (broken)</a></li>
37
	</ul>
38
	<div id="tabs-1">
39
		<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
40
	</div>
41
</div>
42

    
43
</div><!-- End demo -->
44

    
45

    
46

    
47
<div class="demo-description">
48
<p>Fetch external content via Ajax for the tabs by setting an href value in the tab links.  While the Ajax request is waiting for a response, the tab label changes to say "Loading...", then returns to the normal label once loaded.</p>
49
<p>Tabs 3 and 4 demonstrate slow-loading and broken AJAX tabs, and how to handle serverside errors in those cases. Note: These two require a webserver to interpret PHP. They won't work from the filesystem.</p>
50
</div><!-- End demo-description -->
51

    
52
</body>
53
</html>
(1-1/10)