Bootstrap模型显示/隐藏

时间:2017-05-18 00:58:41

标签: jquery twitter-bootstrap

我有成功的ajax调用我有没有显示的bootstrap模型

这是代码

 $(document).ready(function() {
    $('form').submit(function(e){
       var name = $('#name').val();
       var email = $('#email').val();
       var message = $('#message').val();

       var data = 'name=' + name + '&email=' + email + '&message=' + message;

       $.ajax({
        type: "post",
        url: 'script.php',
        data: data,
        success: $(document)ready(function(){
        $("#myModal").modal('show');
        )
       });
        e.preventDefault(); // avoid to execute the actual submit of the form.
    });
  });

1 个答案:

答案 0 :(得分:0)

您的代码中存在一些错误和语法错误

试试这个

$(document).ready(function() {
    $('form').submit(function(e){
       var name = $('#name').val();
       var email = $('#email').val();
       var message = $('#message').val();

       var data = 'name=' + name + '&email=' + email + '&message=' + message;

       $.ajax({
        type: "post",
        url: 'script.php',
        data: data,
        success: $(document).ready(function(){  //missing . before ready
        $("#myModal").modal("show");
        }) // you was missing } here
       });
        e.preventDefault(); // avoid to execute the actual submit of the form.
    });
  });