title: click-spam protection with jQuery and Ajax?
body: <p>I want to make a validation (click-spam-protection), if a user clicks on too much links in some seconds.
  Let's say I want to restrict one href button of the same type to activate a counter that prevents to be allowed to click on this href button again in 10 seconds.</p>
  
  <p>I have a list of events you can join as a user like the join-button on facebook of an event. But because these event-list is very compact, there are many join-buttons. That's why I want to prevent the user spamming the database by clicking on these join-buttons.</p>
  
  <p>I'm using jQuery in and this is my code:</p>
  
  <pre><code>$(function() {
    $(".event_join").click(function() {
  
      var id = $(this).attr("id");
      var uid = &lt;?php echo $_SESSION['uid']; ?&gt;;
      var dataString = 'event_join=' + id + '&amp;uid=' + uid;
  
      if (uid == '') {
        alert("not logged in");
      } else {
        $("#event_" + id).html('Joining the guestlist...');
  
        $.ajax({
          type: "POST",
          url: "ajax_insert.php",
          data: dataString,
          cache: false,
          success: function(html){
            $("#event_" + id).html('You're on the guestlist!');
          }
        });
      } return false;
    });
  });
  </code></pre>
  
  <p>Is it an usual way to validate in the ajax_insert.php file? If yes, how can I tell jQuery it wasn't a "success" and print out the error?</p>