创建选项卡面板作为提交事件

huangapple go评论101阅读模式
英文:

Create Tab panel as submit event

问题

<div class="panel panel-primary tabs-style-2">
    <div class="tab-menu-heading">
        <div class="tabs-menu1">
            <!-- Tabs -->
            <ul class="nav panel-tabs main-nav-line" >
                <li><a href="{{ route('admin.productionData.index') }}" class="nav-link {{ $no_production_tab ? '' : 'active' }}" data-toggle="tab" >Production</a></li>
                <li><a href="javascript:void(0);" onclick="submitForm()" class="nav-link {{ $no_production_tab ? 'active' : '' }}" >No Production</a></li>
            </ul>
        </div>
    </div>
</div>

在 "No Production" 选项卡中,我已将链接更改为使用 JavaScript 调用 submitForm() 函数,您可以在此函数中执行 POST 请求以避免在地址栏中显示 URL。

英文:
<div class="panel panel-primary tabs-style-2">
    <div class="tab-menu-heading">
        <div class="tabs-menu1">
            <!-- Tabs -->
            <ul class="nav panel-tabs main-nav-line" >
                <li><a href="{{ route('admin.productionData.index') }}" class="nav-link {{ $no_production_tab ? '' : 'active' }}" data-toggle="tab" >Production</a></li>
                <li><a href="?no_production_tab=1" class="nav-link {{ $no_production_tab ? 'active' : '' }}" data-toggle="tab" >No Production</a></li>
            </ul>
        </div>
    </div>
</div>

here is my code, its working fine but rather then get method i want use with post method for No Production tab

temp i had added method with href but want to work as post method so url will not display in address bar.

答案1

得分: 0


无生产

英文:
<a href="?no_production_tab=1" onclick="event.preventDefault(); document.getElementById('form-to-submit').submit();">
    No production
</a>

<form id="form-to-submit" action="?no_production_tab=1" method="POST" style="display: none;">
    {{ csrf_field() }}
</form>

You can use the link like this.

huangapple
  • 本文由 发表于 2023年6月13日 18:03:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463765.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定