title: Bootstrap modal firing up incrementing times
body: <p>Bootstrap Modal fires action one time and if I click again it will fire up twice and so on.</p>
  
  <pre><code>&lt;div id="loginModal" class="modal fade"&gt;
      &lt;div class="modal-dialog"&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                  &lt;h4 class="modal-title"&gt;Log In&lt;/h4&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                  &lt;h3&gt;Username&lt;/h3&gt;
                  &lt;input type="text" id="userLogin" placeholder="Username"&gt;
                      &lt;h3&gt;Password&lt;/h3&gt;
                      &lt;input type="password" id="pwdLogin" placeholder="Password"&gt;
                          &lt;br&gt;
                              &lt;br&gt;
                                  &lt;input type="checkbox" id="rememberMe"&gt;Remember Me
                                      &lt;/div&gt;
                                      &lt;div class="modal-footer"&gt;
                                          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                                          &lt;button type="button" class="btn btn-primary" id="btnLogin"&gt;Log In&lt;/button&gt;
                                      &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's the span that fires the modal.</p>
  
  <pre><code>&lt;span id="comment"&gt;&lt;a id="testComment" data-toggle="modal" href="#loginModal" class="btn btn-default"&gt;Add comment&lt;/a&gt;&lt;/span&gt;
  </code></pre>
  
  <p>After I click the span the modal shows. I click the #btnLogin and then the action fires up one time, two times and so on.</p>
  
  <p>javascript that interacts with the modal(the action is within the span click):</p>
  
  <pre><code>$("#testComment").click(function (event) {
      if ($("#msg").val() == "" || $("#nombre").val() == "") {
          alert("To send a comment fill your mail and message!");
          event.stopPropagation();
      }
      else {
          $("#btnLogin").click(function () {
              alert("this also");
              $(this).off('shown.bs.modal');
              if ($("#userLogin").val() != "" &amp;&amp; $("#pwdLogin").val() != "") {
                  var dataToSend = {
                      "action": "LOGIN"
                      , "username": $("#userLogin").val()
                      , "password": $("#pwdLogin").val()
                      , "remember": $("#rememberMe").is(":checked")
                  }
                  $.ajax({
                      url: "data/applicationLayer.php"
                      , type: "POST"
                      , data: dataToSend
                      , dataTpe: "json"
                      , success: function (jsonData) {
                          var data = {
                              "comment": $("#msg").val()
                              , "username": $("#username").val()
                          }
                          $.ajax({
                              url: "data/addComment.php"
                              , type: "POST"
                              , data: data
                              , dataType: "text"
                              , success: function (dataResponse) {
                                  var newHTMLContent = "";
                                  newHTMLContent += "&lt;tr&gt;&lt;td&gt;" + data.username + "&lt;/td&gt;" + "&lt;td&gt;" + data.comment + "&lt;/td&gt;&lt;/tr&gt;";
                                  $("#commentTable").append(newHTMLContent);
                                  alert("Comment was added!");
                              }
                              , error: function (errorMsg) {
                                  alert("Error adding comment in ajax");
                              }
                          });
                      }
                      , error: function (errorMsg) {
                          alert("Login Error");
                      }
                  });
              }
              else {
                  alert('Missing username or password.');
              }
          });
      }
  });
  </code></pre>