PHP how to disable HREF once it is clicked using Jquery or JavaScript? -
my problem how disable href once clicked? please me badly need finish program in php
style.css
.disabled { pointer-events: none; }
- i assume want send cart php
- i assume not want page change
$(function() { $(".cart").on("click",function(e) { e.preventdefault(); // never follow link var $thislink = $(this); if ($(this).not(".added")) { $.post(this.href,function(data) { // return { "successfullyadded":"true" } php if (data.successfullyadded=="true") { $thislink.addclass("added"); $thislink.text("added"); } }); }); }); }); using
<a class="cart" href="?add=<?php echo($i); ?>">add cart</a>
Comments
Post a Comment