0

如何在 URL 中附加用户输入的电子邮件地址,然后通过按钮提交此电子邮件地址?我正在使用一个会弹出的模式,询问电子邮件,然后在用户点击提交按钮时调用 url。(支持jQuery)非常感谢任何帮助!谢谢

<div id="emailModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel"> We Can Help</h3>
              </div>
              <div class="modal-body">

              <h6> Enter your information in the fields below to reset a forgotten password, or to restore access to an account that has been locked for security </h6>
              <br>
               <form >

                    <input type="text" class="input-block-level" placeholder="Email address">
                   <!-- <input type="password" class="input-block-level" placeholder="Password">
                    <label class="checkbox">
                       <a href="#"><input type="checkbox" value="remember-me"> Remember me
                    </label></a> -->

                  </form>
              </div>
              <div class="modal-footer">

                <button class="m-btn blue" data-dismiss="modal">Submit</button>
              </div>
            </div>
4

2 回答 2

2

你可以做类似的事情

$("#emailModal .m-btn").click(function(){
   $.post("/my/url?email=" + $("#emailModal input.input-block-level").val(), function(){
      // this function is called on POST finish.
   });
   return false;
});

我想这就是你所追求的。

于 2013-10-02T18:46:49.453 回答
1

把表格改成这个...

<form action="some-url.php" method="get">
    <input type="text" name="email" class="input-block-level" placeholder="Email address">
</form>

并添加此脚本...

$("#emailModal button").on("click", function() {
    $("#emailModal form").submit();
});
于 2013-10-02T19:26:53.930 回答