Skip to content

Instantly share code, notes, and snippets.

@maxchirkov
Created February 16, 2012 23:27
Show Gist options
  • Save maxchirkov/1848734 to your computer and use it in GitHub Desktop.
Save maxchirkov/1848734 to your computer and use it in GitHub Desktop.
jQuery UI Tabs Test
<?php
if(isset($_GET['q']))
die($_GET['q']);
?>
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'></script>
</head>
<body>
<div id="tabs">
<ul>
</ul>
</div>
<script>
function init_tabs(){
if(jQuery.ui && jQuery.ui.tabs){
var tabAjaxOpts = {
type:'post',
success:function(){alert('onSuccess');},
error:function(){alert('onFail');},
cache: true
};
tabs_obj = jQuery("#tabs").tabs({
ajaxOptions: tabAjaxOpts,
cache: true,
load: function () {
alert('loaded');
}
});
}
}
jQuery(document).ready( function() {
init_tabs();
var tabs = ['Tab One', 'Tab Two', 'Tab Three'];
for(i in tabs){
var content = 'Content for: ' + tabs[i];
var url = 'index.php?q=' + content;
tabs_obj.tabs( "add" , url , tabs[i] );
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment