How to use AJAX loading with Bootstrap tabs?

后端 未结 10 1641
無奈伤痛
無奈伤痛 2020-12-02 08:30

I used bootstrap-tabs.js and it has worked perfectly.

But I didn\'t find information about how to load content through AJAX request.

So, how to use AJAX load

10条回答
  •  忘掉有多难
    2020-12-02 08:57

    Here is the Bootstrap tab Ajax example, you can use it...

    
    
    

    and here is the AJAX call

    $('[data-toggle="tabajax"]').click(function(e) {
        var $this = $(this),
            loadurl = $this.attr('href'),
            targ = $this.attr('data-target');
    
        $.get(loadurl, function(data) {
            $(targ).html(data);
        });
    
        $this.tab('show');
        return false;
    });
    

提交回复
热议问题