Hi i am trying to fix a bug on this plugin for wordpress I am using. The functions looks like this
function alter_ul_post_values(obj, post_id, ul_type) {
jQuery(obj).find("span").html("..");
jQuery.ajax({
type: "POST",
url: "<?php echo get_template_directory_uri() ."/includes/ajax_counter.php";?>",
data: "post_id="+post_id+"&up_type="+ul_type,
success: function(msg) {
jQuery(obj).find("span").html(msg);
}
});
}
and to call the function and count the click comes this line!
<span class='ul_dcont' onclick=\"alter_ul_post_values(this,'$post_id','wpt2_dislikes')\" >".$text."(<span>". $dislike_nr ."</span>)</span>
Now if you click fast (multiclick) over the span it will count all clicks. I want to limit this to one click because the cookie is created after the click and doesn’t allow any more clicks to be counted!
Thank you!
The easiest way is to create global variable. It is not very cute way, but simple and effective.
The other option is to change
spantoinput type="button", setdisabledattribute on click and remove it on callback.