Tabs - Tabs 3 and 4 demonstrate slow-loading and broken AJAX tabs, and how to handle serverside errors in those cases.


SUBMITTED BY: jlolk3r

DATE: Jan. 18, 2016, 8:47 a.m.

FORMAT: HTML

SIZE: 1.7 kB

HITS: 1072

  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="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  7. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  8. <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  9. <link rel="stylesheet" href="/resources/demos/style.css">
  10. <script>
  11. $(function() {
  12. $( "#tabs" ).tabs({
  13. beforeLoad: function( event, ui ) {
  14. ui.jqXHR.fail(function() {
  15. ui.panel.html(
  16. "Couldn't load this tab. We'll try to fix this as soon as possible. " +
  17. "If this wouldn't be a demo." );
  18. });
  19. }
  20. });
  21. });
  22. </script>
  23. </head>
  24. <body>
  25. <div id="tabs">
  26. <ul>
  27. <li><a href="#tabs-1">Preloaded</a></li>
  28. <li><a href="ajax/content1.html">Tab 1</a></li>
  29. <li><a href="ajax/content2.html">Tab 2</a></li>
  30. <li><a href="ajax/content3-slow.php">Tab 3 (slow)</a></li>
  31. <li><a href="ajax/content4-broken.php">Tab 4 (broken)</a></li>
  32. </ul>
  33. <div id="tabs-1">
  34. <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>
  35. </div>
  36. </div>
  37. </body>
  38. </html>

comments powered by Disqus