When my event driven functions are called many repeat themselves.
Looking at debug I can see the functions being run more than once.
For instance the code below will produce:
First time: one original and one duplicate record added.
Second time: one original and two duplicate records added.
Third time: one original and three duplicate records added.
Fourth time: one original and four duplicate records added.
Now if I update a record it will go through the update six times.
And on and on.
$(function() {
$("#btn_add_this_card").click(function (e) {
e.preventDefault();
$('#btn_add_this_card').fadeOut(300);
$.post("cards_insert.php", $("#input_form").serialize());
reset();
return;
});
});
function reset()
{
$("#div_form, #div_cards, #cards_selected_category").hide();
$(".btn").hide();
$( "#btn_add_card").show()
$("#div_categories" ).load( "cards_get_categories.php" );
return;
} ;