AJAX Form duplicate entries on submission
<p>I've got a PHP form set up and it works fine on it's own but now that I've hooked it up with AJAX I'm getting duplicate submissions when someone submits the form so even though they've only submitted the form once it's added the details to the database multiple times.</p>

<p>From my testing it seems as though its sending the data twice but looking at the submissions from other people it's possible that it's doing it more than twice under certain circumstances but I haven't been able to replicate that.</p>

<p>Here is the code I was using initially:</p>

<pre><code>$("#email-gather").submit(function(e) {

    var url = "https://www.ruroc.com/emailgather.php";

        $.ajax({
               type: "POST",
               url: url,
               data: $("#email-gather").serialize(),
               complete: function(data) { 
                    $('.email-win input.button').val("submitted").attr('disabled', 'disabled').css({'background-color' : '#b34c4c','text-shadow' : 'none'});
               }
        });
        e.preventDefault();
    }); 
</code></pre>

<p>I have had a look around to find a solution and I saw a few people with similar issues saying that .live should be used instead of .submit so I amended my code this this:</p>

<pre><code>$( "#email-gather" ).live( "submit", function() {

  event.preventDefault();
  var url = "https://www.ruroc.com/emailgather.php";

    $.ajax({
           type: "POST",
           url: url,
           data: $("#email-gather").serialize(),
           complete: function(data) { 
                $('.email-win input.button').val("submitted").attr('disabled', 'disabled').css({'background-color' : '#b34c4c','text-shadow' : 'none'});
           }
    }); 
});
</code></pre>

<p>However this also resulted with the same issue so I'm hoping you might have a solution to this issue. I appreciate any help you can provide on the matter.</p>