jquery ui tab ajax 切换,默认选中第一个(序号为0)
2017-04-12 16:20
176 查看
<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"); } }); }
相关文章推荐
- easyui tree 默认选中第一个元素
- UITableView默认选中第一个cell
- [Android疑难杂症]Gallery默认和横竖屏切换选中状态问题(2.3、2.3系统存在)
- 表视图默认选中第一个cell以及button外沿特性设置
- jQuery设置下拉框select 默认选中第一个option
- Android(2.2/2.3系统)Gallery解决默认和横竖屏切换选中状态问题
- easyui combobox默认选中第一个
- jQuery设置下拉框select 默认选中第一个option
- 让datagridview默认选中一行,系统默认的是选中第一行的第一个单元格
- easyui combobox默认选中第一个
- UITableView默认选中第一个cell
- 默认tableview选中第一个cell
- RadioGroup动态添加RadioButton,RadioButton设置默认选中第一个,点击其他的RadioButton第一个不再选中,第一个不再选中
- EasyUI 系列之 combobox 默认选中第一个 添加请选择选项
- js切换选择项默认选中10
- IOS开发相关07--UITableView默认选中第一个cell
- UltraWebGrid默认选中第一行及前台body里触发onload事件,实现多个iframe默认关联第一个。
- 微信小程序实现默认第一个选中变色效果
- 默认让页面的第一个控件选中的javascript代码
- Jquery默认选中单选框radio第一个、选中指定值的单选框