Load a tab only once
This commit is contained in:
parent
410060ec8a
commit
11acf0be28
|
@ -458,10 +458,12 @@ BLOCK makeLazyTab %]
|
|||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
var tabsLoaded = {};
|
||||
$('.nav-tabs').bind('show', function(e) {
|
||||
var pattern = /#.+/gi;
|
||||
var id = e.target.toString().match(pattern)[0];
|
||||
if (id == "#[% tabName %]") {
|
||||
if (id == "#[% tabName %]" && !tabsLoaded[id]) {
|
||||
tabsLoaded[id] = 1;
|
||||
$('#[% tabName %]').load("[% uri %]", function(response, status, xhr) {
|
||||
if (status == "error") {
|
||||
$('#[% tabName %]').html("<div class='alert alert-error'>Error loading tab: " + xhr.status + " " + xhr.statusText + "</div>");
|
||||
|
|
Loading…
Reference in a new issue