当前位置: 首页 > 知识库问答 >
问题:

如何在没有按钮点击的情况下打开引导模式?[副本]

王泓
2023-03-14

我需要在我的页面中弹出一个ajax的success函数中的引导模式。success函数是在提交表单时调用的。所以有没有什么方法可以在没有按钮点击的情况下弹出引导模式。我是一个菜鸟。请在这里帮帮我。这是我的ajax调用..

     $("#form").submit(function(e)
   {
       $.ajaxSetup({
           headers:{'X-CSRF-Token' : $('meta[name=_token]').attr('content')}
       });
    e.preventDefault(); //STOP default action
    var postData = $(this).serializeArray();
    console.log(postData);


    var formURL =  "http://localhost:8000/v1/people_roles";

    $.ajax(
    {


        url :formURL ,
        type: "POST",
        data : postData,
        success:function(response, textStatus, jqXHR)
    {

        if(response.parent==1)
        {
            $("#getCode").html(response);
            $("#getCodeModal").modal('show');
             window.location.href="/web/staff/detail.php?id="+response.people_id;
        }
        else
        {
            //console.log(response);
            window.location.href="/web/staff/detail.php?id="+response.people_id;
        }
    }



    });   
    });

这是我的html模式代码..

    <div class="modal fade" id="getCodeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
     <div class="modal-content">
     <div class="modal-header">
         <h4 class="modal-title">Modal title</h4>
     </div>
     <div class="modal-body">
         <p><strong>Lorem Ipsum is simply dummy</strong> text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown
             printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
             remaining essentially unchanged.</p>
     </div>
     <div class="modal-footer">
         <button type="button" class="btn btn-white" ng-click="cancel()">Close</button>
         <button type="button" class="btn btn-primary" ng-click="ok()">Save changes</button>
     </div>
   </div>
  </div>
</div>     

共有1个答案

张献
2023-03-14

$(“#GetCodeModal”).modal(“show”);

您可以参考这篇文章获得更多信息:如何使用jQuery打开引导模式窗口?

 类似资料: