I am unable to set the tab url dynamically. Idea is to conditionally load different views(.html) into #tabsDynamic (fifth tab). Have tried every means but it doesn't work.Idea is to make Ajax Calls to different views and populated the tab
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Tabs - Simple manipulation</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/cupertino/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<style>
</style>
<script>
$(function() {
$("#tabs").tabs({
//before load
beforeLoad: function(event, ui) {
//get Current Selected Tab
var selectedTabIndex = $("#tabs").tabs('option', 'active');
console.log(' selectedTabIndex ' + selectedTabIndex);
$('#tabsDynamic').attr('href', 'contentDynamic.html');
ui.jqXHR.error(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " + "If this wouldn't be a demo." );
});
},
//load
load: function (event, ui) {
console.log(' load event ' );
},
//after activate
activate: function (e, ui) {
console.log(' activate tab ');
}
});
});
});
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Preloaded</a></li>
<li><a href="content1.html">Tab 1</a></li>
<li><a href="content2.html">Tab 2</a></li>
<li><a href="content3.html">Tab 3</a></li>
<li><a href="content4.html">Tab 4</a></li>
<li><a id="#tabsDynamic" href="#">On Demand Ajax </a></li>
</ul>
<div id="tabs-1">
<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>
</div>
</div>
</body>
</html>