jquery - PHP file being called according to the number of clicks -
i have jquery post:
$('.form-submit').click(function () { var form = $(this).attr('data-form'); $("#" + form).submit(function (e) { e.preventdefault(); $.ajax({ url: "../assets/action/action.php", type: "post", data: new formdata(this), contenttype: false, cache: false, processdata: false, success: function (data) { $(".return-post-msg").html(data); } }); }); })
it's working fine, if click button.form-submit
again, jquery post called once action.php
file called twice. if click again, 3x...
all have in action.php
is
echo " alert('".$method." aaaaa'); ";
to check how many times file being called.
Comments
Post a Comment