小编ale*_*iel的帖子

如何在没有按钮单击的情况下打开bootstrap模式?

我需要在我的页面中的ajax的成功函数中弹出一个bootstrap模式.当提交表单时调用成功函数..,有没有任何方法弹出bootstrap模式而不点击按钮.我是一个新手..,请帮帮我.这是我的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;
        }
    }



    });   
    });
Run Code Online (Sandbox Code Playgroud)

这是我的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 …
Run Code Online (Sandbox Code Playgroud)

html javascript ajax jquery twitter-bootstrap

11
推荐指数
1
解决办法
5万
查看次数

标签 统计

ajax ×1

html ×1

javascript ×1

jquery ×1

twitter-bootstrap ×1