提交 AJAX 窗体后刷新选项卡而不刷新视图



刷新选项卡和选项卡中的数据而不刷新 ajax 表单上的视图

 $(document).off('click','.updatepro');
 $(document).on('click','.updatepro',function(){
    $('#user-update').ajaxSubmit({
        // dataType:'json',
        success:function(response){
            $('#userupdate').modal('hide');
            //$('#tab3').tabs('refresh');
            //document.location.reload(true)
            //$("#userupdate").html(response);
            window.location.href += "#tab2";
            location.reload();
        }
    })
 });

当我提交弹出表单时,表单关闭并刷新视图,但我想要的只是刷新其中的选项卡和数据而不刷新整个视图

function click()
{
location.href();
$("#divID").load(location.href +"#divID");
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="divID">
div is loadedsadsadsafdas
dfdaf
</div>
<div id="DONOTLOADED">
something which is not loaded
</div>
<input type="button" onclick="click()" value="Load Only first Div"/>

这是我是如何做到的

$(document).off('click','.updatepro');
 $(document).on('click','.updatepro',function(){
    $('#user-update').ajaxSubmit({ 
        dataType:'json',
        success:function(response){
            if(response.type == 'success'){
                $('#userupdate').modal('hide');
                $('#tab2').trigger('click');
                $('.modal-backdrop').remove();
            }else{
                alert(response.message);
            }
            alert("Detail Updated");
            console.log(response);
        }
    })
 });

从控制器发送成功类型,并在类型为成功时使用触发器重新加载选项卡。

最新更新