javascript发布成功后隐藏/显示导航项

xtupzzrd  于 2021-10-10  发布在  Java
关注(0)|答案(0)|浏览(249)

我有一个导航栏,上面有4个导航项目,希望在我提交表格并收到回复之前隐藏其中一个项目。这可能吗?表单发布到外部api,成功后将返回一些选项,我希望在4导航项上显示这些选项。我可以毫无问题地显示回复,但我更希望在帖子成功之前不要看到第四个导航项,否则它无论如何都是空白的
html

<ul class="nav nav-stretch nav-line-tabs nav-line-tabs-2x border-transparent fs-5 fw-bolder flex-nowrap"
                    id="myTab" role="tablist">
                    <li class="nav-item" role="presentation">
                        <a class="nav-link active text-active-primary me-6" id="freight-tab" data-toggle="tab"
                           href="#freight" role="tab" aria-controls="home" aria-selected="true">Freight</a>
                    </li>
                    <li class="nav-item" role="presentation">
                        <a class="nav-link text-active-primary me-6" id="order-tab" data-toggle="tab" href="#order"
                           role="tab" aria-controls="profile" aria-selected="false">Order Details</a>
                    </li>
                    <li class="nav-item" role="presentation">
                        <a class="nav-link text-active-primary me-6" id="customer-tab" data-toggle="tab"
                           href="#customer" role="tab" aria-controls="messages" aria-selected="false">Customer
                            Details</a>
                    </li>
                    <li class="nav-item disabled" role="presentation">
                        <a class="nav-link text-active-primary me-6" id="aervices-tab" data-toggle="tab"
                           href="#services" role="tab" aria-controls="messages" aria-selected="false">>Freight Services</a>
                    </li>
                </ul>

javascript

$(document).on('click', 'button[data-wizard-type="action-submit"]', function (e){
        e.preventDefault();
        let wizardData = $("#freight_form").serialize();
        console.log(wizardData);
        $.post({
            url: "{{ route('warehouse.shipping.post_shipping_data') }}",
            data: "order_number={{$order_details->order_number}}&" + wizardData,
            success: function(result){
                const obj = JSON.parse(result);

                console.log(obj.availableFreightServices);
                Swal.fire({
                    position: "top-right",
                    icon: "success",
                    title: "Your work has been saved",
                    showConfirmButton: false,
                    timer: 1500
                });
            }
        })
    });

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题