成功ajax调用后如何显示bootsrap 4 modal

时间:2018-11-26 06:12:10

标签: javascript reactjs bootstrap-4

export function _UserSignUp(data) {
dispatcher.dispatch({
    type:'Loader',
    showLoader: true
})
data = JSON.stringify(data);
let actualurl = BASE + url;
Api._callAPI(actualurl, 'POST', data, (type, dt) => {
    if (type == 'success') {
        $("#successRegistration").modal('show');
    }
});
}


<div className="modal fade in" id="successRegistration">
<div className="modal-dialog popupbox">
    <div className="modal-content">
        <div className="modal-body">
            <div className="row">
                  <div className="col-md-12 text-center">
                      <h3 className="alert_txt">{popupstatus == "success" ? "Registered Successfully" : null}</h3>
                    <h3 className="alert_txt">{popupstatus == "failure" ? popupresponse : null}</h3>
                </div>
            </div>
        </div>

        <div className="modal-footer">
            <div className="row">
                <a href="/" className="btn btn-primary btn-round btn-simple float-right hidden-xs m-l-10" >Close</a>
            </div>
        </div>


    </div>
</div>

  <!DOCTYPE html>
  <html lang="en">
 <head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

 <link rel="icon" type="image/png" sizes="16x16" href="images/favicon.png">
 <title>Individual Portal</title>
 <link href="css/style.custome.css" rel="stylesheet">
 </head>

<body class="skin-megna fixed-layout">
<div id="app"></div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/perfect-scrollbar.jquery.min.js"></script>

<script src="/bundle.js"></script>

</body>
</html>

我正在成功调用ajaxAJax调用我试图调用模式,成功调用之后我也无法打开模式

我遇到错误$ is not defined,我在index.html中已经有用于jquery的脚本,但仍然无法打开模型,这是正确的方法,还是有其他替代方法。

1 个答案:

答案 0 :(得分:0)

尝试一下:

     $(document).ready(function() { 
          $("#successRegistration").modal('show'); 
     });