如何将数据从引导模式发送到控制器

时间:2014-08-09 18:39:27

标签: javascript php twitter-bootstrap modal-dialog ajaxform

我忘了密码"链接,当我点击它时出现一个模态,并希望您的电子邮件为用户发送重置密码代码。

这是我的模态形式:

<a href="#" data-target="#myModal" data-toggle="modal">forgot password</a>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-   labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog">
 <div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal"><span aria-   hidden="true">&times;</span><span class="sr-only">Close</span></button>
    <h4 class="modal-title" id="myModalLabel">reset password</h4>
  </div>
  <div class="modal-body">
       <div class="row">
      <form action="reset.php" id="reset_form" class="form-horizontal" method="post">    

  <div class="form-group">
  <div class="col-xs-12">
 <input id="reset_password" class="form-control" placeholder="enter your email">
      </div>
 </div>
 <button type="submit" id="send_email" class="btn btn-primary">send</button>
</form>
  </div>
  <div class="modal-footer">
 </div>
 </div>  
</div>

它是我的javascript:

  <script type="text/javascript">

  $("#reset_form").submit(function(event) {

event.preventDefault();
var resetPass = $('#reset_password').val();
if(resetPass){

$.post("http://localhost:81/denzim/public/login/reset/passwor", {resetPass:            resetPass}).done(function(data) {
$('#reset_form').hide("slow");  
});
}
else{
alert("enter email");
}    });
</script>

我是js的新手。但是我从一本书中给了它。可以帮助 ? 谢谢你的时间

0 个答案:

没有答案