Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 引导模式在表单提交和页面刷新后保持打开状态_Javascript_Jquery_Html_Forms_Twitter Bootstrap - Fatal编程技术网

Javascript 引导模式在表单提交和页面刷新后保持打开状态

Javascript 引导模式在表单提交和页面刷新后保持打开状态,javascript,jquery,html,forms,twitter-bootstrap,Javascript,Jquery,Html,Forms,Twitter Bootstrap,我有一个引导模式表单,我用它来发送一个4字段的消息。按下提交按钮后,我想向用户显示一条“谢谢”消息。但是,我的表单正在关闭,页面正在刷新 如何使模式表单保持打开状态,以便在“提交”按钮下方显示消息 谢谢大家! <section class="modal-form"> <!-- Modal Video first page --> <div class="modal fade" id="participa-modal" tabindex="-1"

我有一个引导模式表单,我用它来发送一个4字段的消息。按下提交按钮后,我想向用户显示一条“谢谢”消息。但是,我的表单正在关闭,页面正在刷新

如何使模式表单保持打开状态,以便在“提交”按钮下方显示消息

谢谢大家!

      <section class="modal-form">
  <!-- Modal Video first page -->
  <div class="modal fade" id="participa-modal" tabindex="-1" role="dialog" aria-labelledby="participa-modal">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel">Participă la un demo!</h4>
        </div>
        <div class="modal-body">
          <div class="form-group">
            <form id="form" method="post" class="contact" action="" enctype="multipart/form-data" data-parsley-validate>
                <div class="row">
                  <div class="col-md-6">
                    <div class="form-group">
                      <input type="text" name="homepage_firstname" id="homepage_firstname" class="form-control-contact" placeholder="Nume" required>
                    </div>
                    <div class="form-group">
                      <input type="email" name="homepage_email" id="homepage_email" class="form-control-contact" placeholder="Email" required>
                    </div>
                    <div class="form-group">
                      <input type="text" name="homepage_phone" id="homepage_phone" class="form-control-contact" placeholder="Telefon" data-parsley-type="number" minlength="10" maxlength="10" required>
                      <input type="hidden" name="inner_message" id="inner_message" value="Participare demo curs!">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <textarea class="form-control-contact" name="homepage_message" id="homepage_message" placeholder="Scrisoare de intentie"></textarea>
                    </div>
                  </div>
                </div>
                <div class="form-actions">
                    <input type="hidden" name="homepagesubmitted" value="TRUE" />
                    <button type="submit" class="btn orange sign-in-btn">Înscrie-te</button>
                </div>
                <?php echo $homepage_send ?>
              </form>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- End Modal Video first page -->
  </section>

&时代;
参加联合国演示!
Înscrie te
更新: 好啊因此,我已通过以下代码
$(函数(){
var frm=$(“#参与模式”);
提交财务报表(功能(ev){
$.ajax({
类型:frm.attr('method'),
url:frm.attr('action'),
数据:frm.serialize(),
成功:功能(数据){
警报(“正常”);
location.reload();
}
});
ev.preventDefault();
});
});

问题是如何在发送按钮下的同一弹出窗口中替换提醒(“确定”)以表示感谢

$(".modal-body form").submit(function(e) {
    var url = "ActionScript.php"; // the script where you handle the form input.
    $.ajax({
           type: "POST",
           url: url,
           data: $(this).serialize(), // serializes the form's elements.
           success: function(data) {
               $(this).html("Thank you!!!");
           }
         });
    e.preventDefault(); // avoid to execute the actual submit of the form.
});
检查上述代码以了解您的要求

使用的术语

$(“.modal body form”)
类和子表单选择器,以便以提交的
表单为目标

.submit(
在表单的
submit
上触发事件

类型:“POST”
用于通过POST方法安全地遍历数据

.serialize()
用于收集(组装)和发送过账数据

success:
是一个回调,以便在提交成功时继续

检查上述代码以了解您的要求

使用的术语

$(“.modal body form”)
类和子表单选择器,以便以提交的
表单为目标

.submit(
在表单的
submit
上触发事件

类型:“POST”
用于通过POST方法安全地遍历数据

.serialize()
用于收集(组装)和发送过账数据


success:
是一个回调,以便在提交成功时继续进行。

您可以显示标记吗?请提供您的代码。我已经发布了我的代码。
$(“表单”).submit(函数(){$('#myModal').modal('show');})
。?您能显示标记吗?请提供您的代码。我已经发布了代码。/我使用了引导模式表单。
$(“表单”).submit(函数(){$('.#myModal')。模式('show');)
。?没关系,我以前试过,但我不想将感谢信息显示为javascript pop ul,而是想在提交按钮下方显示为html div。实际上,我想做的是提交表单-刷新页面,并在表单未关闭的情况下显示感谢信息。因此,您需要澄清问题e@AdrianAdr.所以你需要在这里应用条件类的东西..提交表单后,用一些额外的查询字符串重定向到同一页面,例如?action=submitted.请求该操作,检查条件,如果(action==submitted){show your html}或者{show normal one},要显示模式表单,你可以使用jQuery$(“#参与者模式”)。模式(“展示”);,谢谢!!!没关系,我以前也试过,但我不想将感谢信息显示为javascript pop ul,而是想在“提交”按钮下方将其显示为html div。实际上,我想做的是提交表单-刷新页面并在表单未关闭的情况下显示感谢信息。因此,您需要澄清问题mate@AdrianAdr.所以你需要在这里应用条件类的东西..提交表单后,用一些额外的查询字符串重定向到同一页面,例如?action=submitted.请求该操作,检查条件,如果(action==submitted){show your html}或者{show normal one},要显示模式表单,你可以使用jQuery,$(“#“参与模式”;“模式秀”;,谢谢!!!