为bootstrap的tab增加请求操作
生活随笔
收集整理的這篇文章主要介紹了
为bootstrap的tab增加请求操作
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
版權(quán)聲明:歡迎轉(zhuǎn)載,請注明沉默王二原創(chuàng)。 https://blog.csdn.net/qing_gee/article/details/48708591
前言:在進(jìn)行bootstrap的tab切換操作時,我們有的時候需要為其增加請求操作,用來獲取服務(wù)端的數(shù)據(jù)。
$('#myTab a').click(function(e) {// 先獲取項(xiàng)目idvar deal_id = $("#deal_id").val();var tabIndex = $("#tabIndex").val();var href = $(this).attr("href");if (href == '#program') {// 項(xiàng)目基本信息if (tabIndex == 1) {if (deal_id) {location.href = common.ctx + "/project/showProjectBasicInfo?deal_id=" + deal_id;} else {location.href = common.ctx + "/project/initProjectBasicInfo";}} else {$(this).tab('show');}} else if (href == '#reback') {// 項(xiàng)目回報(bào)信息if (deal_id && !tabIndex) {location.href = common.ctx + "/project/showProjectRebackInfo?deal_id=" + deal_id + "&tabIndex=1";} else {$(this).tab('show');}}e.preventDefault();// 取消事件的默認(rèn)動作});我們利用a標(biāo)簽的點(diǎn)擊事件,然后對tab記性判斷后,改變地址欄請求。
總結(jié)
以上是生活随笔為你收集整理的为bootstrap的tab增加请求操作的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 英媒:滴滴和优步每年烧钱64亿
- 下一篇: Ember.js 入门指南——路由切换的