jquery ui tab ajax 切换,默认选中第一个(序号为0)

   <script>
$(function() {
var tabss = $('#tabs').tabs();//[object,object]
var selectedTab = tabss.tabs('option', 'selected');
if(0==selectedTab){
$.ajax({
url: "<%=basePath %>TopicSectionServlet.serv",
type: "post",
data: "key=" + name + "&doaction=check",
dataType: "json",
error:function(){
//dealFail();
alert('fail');
},
success: function (data) {
$("#atab2").html("成功-按部门1111");
}
});
}
$("#tabs").tabs({
select: function(event, ui) {
var name='5b92ed07-ba11-4d3d-bb6b-f642be25d46a';
var htmlStr = "";
if (ui.index == 0) {
$.ajax({
url: "<%=basePath %>TopicSectionServlet.serv",
type: "post",
data: "key=" + name + "&doaction=check",
dataType: "json",
error:function(){
//dealFail();
alert('fail');
},
success: function (data) {
$("#atab2").html("成功-按部门1111");
}
});
}
//
if (ui.index == 1) {
$.ajax({
url: "<%=basePath %>TopicSectionServlet.serv",
type: "post",
data: "key=" + name + "&doaction=check",
dataType: "json",
error:function(){
//dealFail();
alert('fail');
},
success: function (data) {
$("#btab2").html("成功-按部门2222");
}
});
}
//
if (ui.index == 2) {
$.ajax({
url: "<%=basePath %>TopicSectionServlet.serv",
type: "post",
data: "key=" + name + "&doaction=check",
dataType: "json",
error:function(){
//dealFail();
alert('fail');
},
success: function (data) {
$("#ctab2").html("成功-按部门3333");
}
});
}
//
if (ui.index == 3) {
$.ajax({
url: "<%=basePath %>TopicSectionServlet.serv",
type: "post",
data: "key=" + name + "&doaction=check",
dataType: "json",
error:function(){
//dealFail();
alert('fail');
},
success: function (data) {
$("#dtab2").html("成功-按部门4444");
}
});
}
//
if (ui.index == 4) {
$.ajax({
url: "<%=basePath %>TopicSectionServlet.serv",
type: "post",
data: "key=" + name + "&doaction=check",
dataType: "json",
error:function(){
//dealFail();
alert('fail');
},
success: function (data) {
$("#etab2").html("成功-按部门5555");
}
});
}
//
}
});
});
</script>


//
				  if (ui.index == 1) {
//加载版块数据
$.ajax({
url: "<%=basePath %>TopicServlet.serv",
type: "post",
data: "key=" + name + "&doaction=statisticsBySectionId",
dataType: "json",
error:function(){
alert('数据加载失败!');
},
success: function (data) {
var len=data.length;
//所有版块
$('#sectionName-s').contents().remove();
$('<option >请选择</option>').appendTo('#sectionName-s');
for(i=0;i<len;i++){
$("#sectionName-s").append($('<option value='+data[i].tsb.id+'>'+data[i].tsb.sectionName+'</option>'));
}
//所有数据
$("#btab2").html("成功-按部门2222");
}
});
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值