I try to allow a button to click only once, and then some data is passed through ajax. The problem I am facing is that the user can click 50x and the POST data is sent every time?
jQuery("#id").unbind('click');
jQuery.ajax({
type: "POST",
url: ajax_url,
data: ajax_data,
cache: false,
success: function (html) {
location.reload(true);
}
});
How can I make sure that if the user clicks #ID100x - that the data is sent only once? And then #ID is on again?
source
share