title: How can I reset an Ajax success function?
body: <pre><code>   $(document).on("click", ".example", function (event) {
          alert("test");
          var id = 1;
          $.ajax({
              url: "update.php",
              data: {
                  id: id,
              },
              type: "POST",
              success: function (data) {
                  $("#result").html(data); 
              }
          }) 
      });
  </code></pre>
  
  <p>If I remove this line...</p>
  
  <pre><code> success: function (data) {
     $("#result").html(data); 
   }
  </code></pre>
  
  <p>... then "test" is alerted on every click only once. </p>
  
  <p>But with this line every time I click on my <code>.example</code> button, "test" is alerted on more time.</p>
  
  <p>So this means:</p>
  
  <ul>
  <li>First click --> alert "test"</li>
  <li>Second click --> alert "test", alert "test"</li>
  <li>Third click ---> alert "test, alert "test", alert "test"</li>
  </ul>
  
  <p>... and so on.</p>
  
  <p>I think it is caused because the <code>.example</code> button was also created by Ajax before.</p>
  
  <p>So is there a possibility to reset somehow the success function? </p>